如何在 VS2008 中将用户控件构建到自包含程序集中?

How do I build a user control into a self-contained assembly in VS2008?(如何在 VS2008 中将用户控件构建到自包含程序集中?)
本文介绍了如何在 VS2008 中将用户控件构建到自包含程序集中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更具体地说,在不同于 VS2005 的 Visual Studio 2008 中执行此操作需要了解什么?我在 VS2005 中找到了相当多的参考资料,例如

More specifically, what do I need to know about doing this in Visual Studio 2008 that's different from VS2005? I have found a decent number of references for doing this kind of thing in VS2005, such as

  • http://webproject.scottgu.com/CSharp/usercontrols/usercontrols.aspx
  • 跨项目分发 ASP.NET 用户控件的技术
  • http://weblogs.asp.net/scottgu/archive/2005/08/28/423888.aspx
  • http://support.microsoft.com/kb/324785

但即使是 Microsoft 的参考资料似乎也没有对 VS2008 进行太多说明.这个问题源于我之前问过的一个问题,在这里找到.

but even the Microsoft reference doesn't seem to say much about VS2008. This question stems from one I asked earlier, found here.

更进一步,一旦我设法构建其中一个程序集(可能是 DLL),其他人需要对我的 DLL 做什么才能将它(作为单个页面,或者可能是子部分)包含在他们的 ASP.NET 网站?

Going one step further, once I manage to build one of these assemblies (presumably a DLL), what would someone else need to do with my DLL in order include it (as a single page, or maybe sub-section) in their ASP.NET web site?

出现了更多搜索 this,它看起来很像我想要弄清楚的(但不完全是).要么:

Still more searching has turned up this, which looks a lot (but not exactly) like what I am trying to figure out. Either:

  • 我为 ASP.NET 网站 Web 应用程序编写代码,然后以某种方式将其交给主 ASP.NET 网站的所有者,或者
  • 我只为应用程序编写代码(从而创建用户控件),并且不知何故,主 ASP.NET 网站的所有者将我的用户控件推到了他们的网站中.
  • I write the code for both the ASP.NET Web Site and Web Application, and then somehow hand that off to the owner of the main ASP.NET web site, or
  • I only write the code for the Application (thus creating the user control), and somehow the owner of the main ASP.NET web site shoves my user control into their site.

我希望这能澄清我的问题.

I hope this clarifies what I'm asking.

推荐答案

我终于弄清楚了如何做我需要的.here 的布局非常好(尽管文章声称适用于 VS2005),但最终归结为以下几点:

I finally figured out how to do exactly what I need. It's laid out pretty nicely here (even though that article claims to apply to VS2005), but in the end it boils down to just a few things:

  1. 在 ASP.NET 网站而非 Web 应用程序中创建用户控件.
  2. 为用户控件声明提供一个包含自定义命名空间的类名,如链接页面中第 1 步末尾所述.
  3. 编写和测试用户控件后,按照步骤 3 中的说明创建 DLL 程序集
  4. 使用它,如第 5 步所述.

我之前遇到的最大问题是我在 ASP.NET Web 应用程序而不是网站中构建用户控件.我花了很多时间来解决这个问题,希望这个答案至少可以节省另一个新的 ASP.NET 开发人员在术语和细微差别上苦苦挣扎的时间.干杯!

The biggest problem that I had before was that I build the user control inside of an ASP.NET Web Application instead of a Web Site. I spent so many hours banging my head against this, hopefully this answer will save at least one other new ASP.NET dev the hours of slogging through the terminology and subtle differences. Cheers!

这篇关于如何在 VS2008 中将用户控件构建到自包含程序集中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
how do i pass parameters to aspnet reportviewer(如何将参数传递给aspnet report查看器)
Bind multiple parameters from route and body to a model in ASP.NET Core(在ASP.NET Core中将路由和主体中的多个参数绑定到一个模型)
Custom model binding in AspNet Core WebApi?(AspNet Core WebApi中的自定义模型绑定?)
How to minify in .net core mvc view?(如何在.Net核心MVC视图中缩小?)