Is it possible to create a .Net MSI/setup project which can add an assembly “X” to both version 2 and version 4 of the .NET framework GAC?
I have tried by adding the output from 2 projects to the GAC special folder, e.g.:
“XTargetingV3.5.csproj” “XTargetingV4”.csproj”
However, I get the following which is understandable:
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')
This also happens if I try to add a merge module containing “X” targeting one of the frameworks.
I would like my existing client application which was built to target v3.5 of the .Net framework, (hence looks in C:\Windows\Assembly for “X”), to continue to use this GAC, whereas new clients built to target v4 of the .Net framework will also find “X” by looking in the new GAC (C:\Windows\Microsoft.NET\assembly). Therefore when “X” is updated, the MSI installer will install “X” to both GACs so v3.5 clients and v4 clients will get the update.
I understand that I can request the old v3.5 client to use v4 of the runtime instead (see Redirecting Assembly versions to a different CLR/GAC开发者_运维百科) using:
<configuration>
<startup>
<supportedRuntime version="v4.0" />
</startup>
</configuration>
but I am trying to avoid creating app.configs for existing clients.
Framework 4 GAC has a sub folder inside the GAC directory. Use gacutil to see the path.
精彩评论