在dll中存储类文件并在asp.net中将dll用于多个网站
我想在 VS2005 中创建一个类文件,并能够在我的计算机/生产服务器上的其他网站中使用它。如何创建这个 dll 并将其存储在一个公共位置,以便我可以在开发时以及生产服务器上引用它?
I want to create a class file in VS2005 and be able to use it in other websites on my computer / production server. How do I create this dll and store it in a common place where I can reference it while developing and also on the production server ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
除非您拥有主机服务器的完全管理权限,否则请避免使用 GAC。
您可以做的是创建一个包含共享 DLL 源代码的项目。然后,您可以将此项目添加到每个网站解决方案中,并将网站解决方案中的引用添加到该项目中。这样做的另一个优点是使您能够在调试期间进入共享源代码。
Avoid the GAC unless you have full administration rights on the host server.
What you could do is create a project containing the source for your shared DLL. You can then add this project into each of your web site solutions, and add a reference in your site solutions to the project. This has the added advantage of enabling you to step into your shared source during debugging.
首先将类库项目添加到您的解决方案中。将此类添加到该库中。并将此类部署到全局程序集缓存 (GAC)。您可以按照这些步骤将程序集安装到 GAC。
First add a class library project to your solution. Add this class into this library. And deploy this class to Global Assembly Cache (GAC). You can follow these steps to install your assembly to GAC.