可我的.net应用程序引用两个不同版本的.NET框架库?我的、应用程序、框架、不同

2023-09-03 06:50:32 作者:-╇ミ╰→青春少男

说我有两个项目,P4和P3,分别打靶.NET 4.0和3.5。

Say I have two projects, P4 and P3, targetting .net 4.0 and 3.5 respectively.

每个项目还引用了System.Data这。 在P4的情况下,这将是对System.Data这V4.0.0.0 在P3的情况下,这将是对System.Data这V2.0.0.0

Each project also has a reference to System.Data. In the case of P4, it will be to System.Data v4.0.0.0 In the case of P3, it will be to System.Data v2.0.0.0

项目P4还引用P3。

如果P4被加载并执行时,它使用.NET 4.0 CLR。在运行时,引用System.Data这似乎决心V4.0两个P4和P3内。我可以用assemblyBinding重定向重写此,但随后双方P4和P3决心V2.0。

If P4 is loaded and executed, it uses the .net 4.0 CLR. At runtime, references to System.Data seem to resolve to v4.0 inside both P4 and P3. I can override this by using assemblyBinding redirects, but then both P4 and P3 resolve to v2.0.

有什么办法,我可以配置我的应用程序,以便P4采用V4.0和P3采用2.0?

Is there any way I can configure my application so that P4 uses v4.0 and P3 uses v2.0?

推荐答案

有一个看看这个:的在进程侧并排这可能是一些帮助。

Have a look at this : In-Process Side-by-Side It might be of some help.