开发者

Developing and using a custom ASP.NET web control in a single solution

I have a solution with a web site and also a class library with a control which inherits from the WebControl class. When I place the control in the toolbox and use it in the web site, I can no longer build the solution - Visual Studio (the compiler) complains ab开发者_运维百科out the class library DLL being used by another process (which I suspect is VS itself).

Is there a way to develop and use a custom ASP.NET web control in a single solution? Or am I missing something here?


I don't think you need to actually add the dll to your toolbox, I think VS just knows your control is there. But in any event you can just add the reference to the control in your controls section of the web.config and you can just add the markup for your control in the source of the .aspx page.

Here is how I did it in the new version of the Beer House:

<!--http://weblogs.asp.net/scottgu/archive/2006/11/26/tip-trick-how-to-register-user-controls-and-custom-controls-in-web-config.aspx-->


I just tested this out in VS2008 and I didn't have a problem.

Did you add the dll to the references of the project? Because you shouldn't do that.

Did you use the dll in the bin directory, or the obj directory? I use the dll in the bin directory.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜