在解决方案中引用自定义库程序集的最佳实践
在我们公司,我们有一个自定义库。我们在大多数项目中都使用它,并且我们的库仍在开发中。因此,有时我们必须在一天内构建和生成新程序集两次或更多次。
我们使用 GAC 来存储我们的自定义库程序集。正如您猜测的那样,用新组件替换 GAC 会变得无聊。
因此,我们决定在解决方案中创建一个名为“Referenced Assemblies”的文件夹,并创建一个“解决方案项”文件夹,并将程序集添加到此解决方案文件夹中。因此,当我们从 TFS 获取最新版本时,我们可以获得新版本的程序集。这比 GAC 更容易(但理论上)
当我们开始使用时;问题变得清晰起来。例如,有时 Visual Studio 将 DLL 标记为“删除、锁定”,尽管未删除。或者有时当我们的团队成员打开表单时,设计器会因为在程序集中找不到相关类而抛出异常。我们不得不多次重建解决方案或重新启动 Visual Studio。
将程序集存储在 GAC 或引用程序集文件夹中存在一个常见问题。您需要将新程序集放在某处以共享其他团队成员。例如,如果程序集存储在 GAC 中,它们可以通过 UNC 共享,否则如果程序集存储在引用的程序集文件夹中,则新程序集已复制到所需的其他项目。
在解决方案中存储引用的程序集的最佳实践是什么?
我们使用 VS 2010 和 TFS 2010。 我们的项目框架版本是3.5
In our company we have got a custom library. We are using it in most of projects and our library is still developing. So sometimes we had to build and generate new assemblies twice or more in a day.
We were using GAC to store our custom libraries assemblies. As you guess replacing GAC with new assemblies become boring.
For this reason we decided to create a folder in solution that name is Referenced Assemblies and created a Solution Items folder and added assemblies this solution folder. So when we Get Latest from TFS we can get new versions of assemblies. This is more easier than GAC (but in theoratically)
When we started to use; problems became clear. For example sometimes Visual Studio marks DLL "delete,lock", despite not delete. Or sometimes when our team members open a form, designer throws exception because of could not find releated classes in assemblies. We had to rebuild solution or restart Visual Studio for several times.
Storing assemblies in GAC or Referenced Assemblies folder has a common problem. You need to put new assemblies somewhere to share other team members. For example, if assemblies stored in GAC, they can share via UNC, else if assemblies stored in Referenced Assemblies folder, new assemblies had been copied to other projects which required.
What is the best practices for storing referenced assemblies in a solution?
We ara using VS 2010 and TFS 2010.
Our projects framework version is 3.5
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看 NuGet / NuPack
http://www.hanselman.com/blog/IntroducingNuPackPackageManagementforNETAnotherpieceoftheWebStack.aspx
http://weblogs.asp.net/ scottgu/archive/2010/10/06/announcing-nupack-asp-net-mvc-3-beta-and-webmatrix-beta-2.aspx
Take a look at NuGet / NuPack
http://www.hanselman.com/blog/IntroducingNuPackPackageManagementforNETAnotherpieceoftheWebStack.aspx
http://weblogs.asp.net/scottgu/archive/2010/10/06/announcing-nupack-asp-net-mvc-3-beta-and-webmatrix-beta-2.aspx