项目参考解决方法.NET 4.5和.NET 3.5 [英] Project reference work-around .net 4.5 and .net 3.5

查看:698
本文介绍了项目参考解决方法.NET 4.5和.NET 3.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在继续为这个线程:
<一href="http://stackoverflow.com/questions/15463163/mixing-net-3-5-with-4-4-5-assemblies-in-the-same-solution-project">Mixing .NET 3.5在同一个解决方案/项目 4 / 4.5组件

In continue for this thread:
Mixing .NET 3.5 with 4/4.5 assemblies in the same solution/project

我找到了一个解决办法:
<一href="http://social.msdn.microsoft.com/Forums/en-US/clr/thread/36b1a209-55d5-4323-91dc-0919ba2e1d03/" rel="nofollow">http://social.msdn.microsoft.com/Forums/en-US/clr/thread/36b1a209-55d5-4323-91dc-0919ba2e1d03/

I found a workaround:
http://social.msdn.microsoft.com/Forums/en-US/clr/thread/36b1a209-55d5-4323-91dc-0919ba2e1d03/

什么是基本上做到,让我的解决方案,编译,并确定在什么样的CLR运行的每个项目。
有谁看到缺点呢?
它建立了项目,在我的第三方API,它必须运行在.NET 3.5中,我明确地写在了App.config中与CLR 2.0,而不是4.0

What it basically do, get my solution compile and determine each project under what CLR to run.
Does anyone see disadvantage to this ?
It builds the projects, on my 3rd party api that must run on .net 3.5, i explicity write on its App.config to run with CLR 2.0 and not 4.0

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

编辑:
我的主要应用程序正在使用.NET 4.5和C#5的功能。我的第三方的API的是,子步骤(i从主开始)运行,并且过程将连接到API,它必须在3.5和CLR2。所以我明确地定义有作为CLR2运行。


My main application is using .net 4.5 and C# 5 features. My 3rd party API is running on a child process (i start from main) and that process will connect to API that must be on 3.5 and CLR2. So i explicity define there to run as CLR2..

推荐答案

您的配置文件将加载.NET 2.0运行时,它会失败在某些点装.NET4.5组件。你真的想你的应用程序在.NET4.5运行时中运行,并能装载3.5组件。你应该尝试下面的配置文件。

Your configuration file will load .NET 2.0 runtime and it would fail at some point loading .NET4.5 components. You really want your app to run in .NET4.5 runtime and be able to load 3.5 components. You should try following config file.

<configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
    </startup>
</configuration>

这篇关于项目参考解决方法.NET 4.5和.NET 3.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆