在单一解决方案中开发和使用自定义 ASP.NET Web 控件
我有一个带有网站的解决方案,还有一个带有继承自 WebControl 类的控件的类库。当我将控件放入工具箱并在网站中使用它时,我无法再构建解决方案 - Visual Studio(编译器)抱怨类库 DLL 被另一个进程(我怀疑是 VS 本身)使用。
有没有办法在单一解决方案中开发和使用自定义 ASP.NET Web 控件?或者我在这里遗漏了什么?
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 about 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不认为你需要实际将 dll 添加到你的工具箱中,我认为 VS 只是知道你的控件在那里。
但无论如何,您都可以在 web.config 的控件部分添加对控件的引用,并且可以在 .aspx 页面的源代码中添加控件的标记。
以下是我在新版本啤酒屋中的做法:
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:
我刚刚在VS2008中测试了一下,没有问题。
您是否将dll添加到项目的引用中?因为你不应该那样做。
您使用的是
bin
目录中的 dll,还是obj
目录中的 dll?我使用bin
目录中的 dll。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 theobj
directory? I use the dll in thebin
directory.