How to reference shared assemblies that are still under development (.NET)

冷暖自知 提交于 2019-12-21 06:24:08

问题


I am responsible for developing and maintaining a set of common, framework assemblies that are used to build our product applications. These assemblies are relatively new and in a state of flux as new features are implemented, etc. As a result, it is not unusual for them to be rebuilt and redistributed somewhat frequently. I would expect this to decrease as the assemblies are stabalized, but it is what it is today.

Right now, the assemblies are placed into a Common folder where the development projects can reference the same assemblies. Applying updates is as simple as replacing the files and the development projects automatically pick-up the changes the next time they are loaded and built.

The problem I have is that we may have several "layers" of assemblies built upon the framework - for instance, we have a Core library shared by all applications and a Server library that references Core and is shared by all Server application. All of the dependancies also have to be rebuilt each time the framework assemblies are updated, making this a very large task. I don't believe I can use the GAC because this would require that all of the developers update their systems each time a new version is released.

I've investigated Publisher Policies but have some doubts that this will solve my problem for a few of reasons:

  • For one, I don't want to recreate the file each time I rebuild my framework assemblies - is there a way I can automate this process?

  • It is not clear to me if it requires that the assemblies go into the GAC. As I said, I don't want to force my developers to reinstall, update, etc. each time we release a new version of the assemblies.

  • I don't have any control over network setup and configuration, so it is necessary to avoid the whole "trust" issue by placing the files in a network share. Plus, many of our developers work in a sometimes connected fashion and we'd want the files available to them when disconnected.

The goal would be to make updating these assemblies transparent to our application developers that are consuming them. We will undoubtedly install these assemblies into the GAC on the target machine when the application is installed, but we don't want to do so for development purposes. It is also not reasonable to include the projects in each application's Solution because they are developed by different teams.

I can't imagine that I am alone in these requirements and hope someone can share their experience and wisdom to guide me to a solution. Thanks!


回答1:


You don't necessarily need to install the assemblies into the GAC - nothing in your setup requires this.

The main issue here is making sure that an assembly forces all of its dependencies to be rebuilt, and that all of these are placed in a shared location.

The easiest option here would probably be to have a build server that rebuilds everything whenever one of the shared assemblies is updated. This also has the advantage of potentially running other "scripts" on the build, such as doing code metrics, static code analysis, etc, whenever a build is checked in.

You can then just have the build server copy everything up to a shared location. If the projects reference from the shared location, and explicitly say not to restrict to a specific version, everything should just work fine.




回答2:


NuGet has solved this problem. By distributing the shared assemblies, frameworks, etc as NuGet packages from a private repository on our network, we can easily post updates and have them applied to client code as appropriate.



来源:https://stackoverflow.com/questions/1422899/how-to-reference-shared-assemblies-that-are-still-under-development-net

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