Search code examples
c#assembliesversioningclass-librarystylecop

Need a C# Assembly to reference a strongly named assembly loosely


So here's the problem. I'm writing some StyleCop plug-in assemblies for use at the company I work for. As such, these assemblies need to reference Microsoft.StyleCop.CSharp.dll for example, which is strongly named.

The problem comes in that if I build this and pass it along to the developers in my group, they must have the same version of the StyleCop dll (currently 4.3.3.0) or it fails to load.

What is the best way to make my add-on rules DLL more independent? Should I just install my 4.3.3.0 version of those subordinate StyleCop dlls in the GAC? Can an assembly (vs an application) use a policy file?

Oh, and one of the main problems is i would like it to work with ANY version of StyleCop the client has installed (or at least 4.3.3.0 or later) if possible.

Many thanks in advance.


Solution

  • Yes you should just install the same version for the other developers. If you do not, you may have unpredictable runtime failures due to changes within StyleCop. Presumably that is why they bothered to increment the version number.

    If you don't want to do this, you can configure a different assembly binding in the app.config file. In the config the actual version number which you intend to use at runtime is needed. And yes, this can even be done via policy. But again, I think you are better served by including the correct DLL in the first place.