2013-02-11 123 views
7

首先,我发现了StackOverflow here上的其他帖子,但它没有解决我的错误。混合模式程序集是针对'v2.0.50727'错误而构建的

我有3个不同的环境/域与每个位置的生成服务器。我的Dev和UAT环境构建得很好,但生产版本不起作用。

,我发现了错误

混合模式组件建立对 运行时的版本“V2.0.50727,且不能在4.0运行时无需额外 配置信息被加载

我已将此标记添加到我的app.config文件(这是我在上面的链接中建议的修复)

<startup useLegacyV2RuntimeActivationPolicy="true"> 
    <supportedRuntime version="v4.0"/> 
    </startup> 

我的构建服务器/环境/域可能会导致此问题有什么不同?

针对艾伦的问题,我相信这是你问:

<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    <PropertyGroup> 
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform> 
    <ProductVersion>8.0.30703</ProductVersion> 
    <SchemaVersion>2.0</SchemaVersion> 
    <ProjectGuid>{D3D87C05-2811-489B-9F0D-7676B6485AA0}</ProjectGuid> 
    <OutputType>Exe</OutputType> 
    <AppDesignerFolder>Properties</AppDesignerFolder> 
    <RootNamespace>MVST.Batch.CorrespondenceConversion</RootNamespace> 
    <AssemblyName>MVST.Batch.CorrespondenceConversion</AssemblyName> 
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> 
    <FileAlignment>512</FileAlignment> 
    </PropertyGroup> 

我有超过100的设置完全相同的方式和那些建立确定的其他项目。

+0

是否在生产环境中安装了.Net 4.0? – TheKingDave 2013-02-11 15:23:42

+0

是的,我在C:\ Windows \ Microsoft.NET \ Framework文件夹中显示以及Framework64文件夹都有v4.0。30319 – ganders 2013-02-11 15:27:14

+0

平台工具集的哪个版本可以满足您的混合模式程序集要求,并且存在于prod服务器上? – allen 2013-02-11 15:38:41

回答

13

http://support.microsoft.com/kb/2572158

添加空话useLegacyV2RuntimeActivationPolicy="true"下方要么下列任一位置的:

  1. sgen.exe.config文件位于以下位置:.. \ Program Files文件\微软SDKs \ Windows \ v7.0A \ bin \ NETFX 4.0 Tools \
  2. 应用程序的app.config文件

<startup useLegacyV2RuntimeActivationPolicy="true"> 

      <supportedRuntime version="v4.0" /> 

</startup>  

+0

我将上述属性添加到了我的app.config中,并且一切正常。 – pennyrave 2015-04-23 16:00:13

+1

我只想指出所需的部分是:useLegacyV2RuntimeActivationPolicy =“true” – Taegost 2016-07-18 17:28:02

0

这是修复工作...仍然不知道为什么我的项目需要2.0,而其他人(在我的问题中的链接)需要4.0。

<startup> 
    <supportedRuntime version="v2.0.50727"/> 
    </startup> 
+0

现在,我已经在我的代码中实现了上述内容来构建它,但现在尝试运行该作业时失败。如果我评论整个部分,那么这项工作将运行良好。那么我怎么在中间遇到?我需要该部分来构建项目,但为了让程序运行,我需要将其注释掉...... – ganders 2013-02-15 13:28:34

2

如果你在64位运行,则可能必须将它添加到Visual Studio测试引擎配置:

C:\ PROGRAM文件(x86)\ Microsoft Visual Studio 11.0 \ Common7 \ IDE \ CommonExtensions \ Microsoft \ TestWindow \ vstest.executionengine.exe.config

像这样添加启动节点:

<startup useLegacyV2RuntimeActivationPolicy="true"> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> 
    <requiredRuntime version="v4.0.20506" /> 
</startup> 
相关问题