I have noticed that it is possible to register for example v1.0.0.0 of an assembly with GACUtil to the GAC at C:\Windows\assembly if the assembly targets v3.5 of the .Net Framework AND also manage to register the same version v1.0.0.0 if the assembly targets v4 of the .Net Framework to the GAC at C:\Windows\Microsoft.NET\assembly.
This results in 2 assemblies with the same version living in different GACs.
This feature is useful, since I would like clients which use the old GAC (C:\Windows\assembly) to see v1.0.0.0 of the assembly without updating their app.config to target v4 of the framework.
Currently I get the following error if I try to add 2 assemblies with the same version to the GAC in the setup project:
WARNING: Two or more objects have the same target location ('[gac]X\1.0.0.0_2752785e627d5953\X.dll') WARNING: Two or more objects have the same target location ('[gac]X\1.0.0.0_2752785e627d5953\X.dll')
If I split into 2 separate projects (one targets v3.5, the other targets v4) and run both installers, only one instance of the assembly is registered in one of the GACs (not both which GACUtil achieves).开发者_如何学运维
I have not been able to find a way of achieving this with a setup/msi project. Is it possible?
Using gacutil in this manner seems to imply that we can target different frameworks for an assembly, install to their respective GAC meaning no change to the client whatsoever. However, the setup/deployment MSI project does not allow this.
Also, when you use GACUtil to view the GAC entry for the assembly, only one is listed; it does not state which GAC it resides in. Therefore it seems the fact that you can register the same version of an assembly to the v2 and v4 GAC with GACUtil does not mean you should. Furthermore, GACUtil is a development tool, and should not be used for deployment.
精彩评论