简体   繁体   中英

Installing assemblies for CLR 2.0 and CLR 4.0 programmatically

I have application, let's name it Installer, that installs my assemblies in GAC using Publish.GacInstall Method.

I faced an issue when the Insteller is run under .Net 4.0 and installs assemblies in GAC for .Net 4.0. When I target .Net framework 2.0 for a project I don't see my assemblies in GAC.

Is it possible to install my assemblies in both GACs?

No, it does not depend on your installer, but on the assemblies it installs. CLR v4 (.Net 4.0 - 4.5.1) assemblies go in the v4 GAC and CLR v2 (.Net 2.0 - 3.5) assemblies go in the v2 GAC. If you want an assembly in both, then you have to have two assemblies for each CLR version.

Since CLR v4 can run CLR v2 applications you can also do with just the CLR v4 assembly. You need change/add a config file with your application. See here .

<supportedRuntime version="v2.0.50727"/> 
<supportedRuntime version="v4.0"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM