如何构建一个用户控件到VS2008一个独立的组装? [英] How do I build a user control into a self-contained assembly in VS2008?

查看:174
本文介绍了如何构建一个用户控件到VS2008一个独立的组装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更具体地讲,我有什么需要了解Visual Studio 2008中这就是不同VS2005这样做呢?我发现引用的一个体面的数量在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
  • Techniques For Distributing ASP.NET User Controls Across Projects
  • http://weblogs.asp.net/scottgu/archive/2005/08/28/423888.aspx
  • http://support.microsoft.com/kb/324785

但即使是微软引用似乎并没有说太多关于VS2008。
这个问题从一茎我刚才问,<一个href=\"http://stackoverflow.com/questions/1138578/how-do-i-embed-an-asp-net-web-site-or-web-application-into-another\">found这里。

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

往前一步,有一次我设法建立这些组件之一(presumably一个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?

编辑:还有更多的搜索已经变成了<一个href=\"http://aleemkhan.word$p$pss.com/2009/02/24/creating-aspnet-usercontrol-libraries-for-use-in-multiple-websites/\"相对=nofollow>这个,这看起来很多(但不完全)像什么,我试图找出。或者:

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


  • 我写的code为ASP.NET网站的的Web应用程序,然后不知何故其交给主ASP.NET网站的所有者或

  • 我只写了code的应用程序(从而创建用户控制),并以某种方式主要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.

我希望这澄清我问。

推荐答案

我终于想通了如何做正是我需要的。它奠定了pretty很好这里(甚至尽管这条号称适用于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步
  4. 描述创建DLL组件
  5. 使用它,因为在步骤5中所述。

  1. Create the user control inside an ASP.NET Web Site, NOT a web application.
  2. Give the user control declaration a class name that includes a custom namespace, as described at the end of step 1 within the linked page.
  3. After writing and testing the user control, create the DLL assembly as described in step 3
  4. Use it, as described in step 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一个独立的组装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆