.Net Assembly /dll Sharing and Deploying

丶灬走出姿态 提交于 2019-12-04 12:39:37

I would go "S1"+"D1", or "S1"+ClickOnce; it makes for simple deployment and versioning, and is compatible with ClickOnce deployment, xcopy deployment, MSI deployment, web, etc. GAC is not appropriate IMO. Re updates; well, you'll want to test/release them individually, no? I have a cascading build configured on my build server, so if I update a library dll it trickles up and rebuilds everything that uses that dll, and upwards (before anyone says: yes, it detects and eliminates cycles).

The "common folder" approach has issues with dll resolution, so by itself is a real PITA.

The GAC approach would work, but is lots of unnecessary effort, and pretty painful to save a few duplicated dlls. It is also a pain if you need to deploy to a non-admin.

S1 + D1 for sure. About the "if any updates..." : this is a benefit rather than a problem. If you change an assembly you will have to rebuild the using projects. The S1 scenario lets you do that project-by-project, no unneeded dependencies between them.

Do not use the GAC for small libraries, and it is a hassle.

If your releases are well planned then putting dlls in GAC is a good option. Contradictory to this fact, if you are adding any small feature and then releasing your product, then GAC is not at all scalable because then you have to make parallel releases of all your products, which I guess not possible. Also, GAC is used to store dlls having common functionality for all the products which are making use of these dlls. So you have to be sure about the functionality you are providing for all the products. This is not at all advisable to add different functionality for every product and storing dlls in GAC. For this you have to be very precise about your version system and releases.

Put everything in your application folder. Putting in GAC only if you really have a large number of code to share, and doesn't update all the time.

The GAC is the place you want the code to ensure that there is only one copy of each version. Don't worry about versioning with the GAC because it handles storing multiple versions of libraries for you.

But generally unless the library is going to be used a lot I would tend to agree with Ngu's answer and put them in your application folder. This will make deployment a fair bit easier too.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!