问题描述
我们必须运行在Visual Studio 2010中的目标。NET 3.5的一个ASP.Net Web应用程序。它是由TFS 2010年建立了这个Web应用程序有几个网页引用,因此该版本会创建一个相关XmlSerializers DLL。这个DLL,但是,是一个.NET 4.0组件。
We have a ASP.Net web application running in Visual Studio 2010 that is targeting .Net 3.5. It's being built by TFS 2010. This web application has a couple web references, so the build creates a related XmlSerializers DLL. This DLL, however, is a .Net 4.0 assembly.
当我运行从生成此Web应用程序,我得到的错误:
When I run this web application from the build, I get the error:
无法加载文件或程序集 BLAH_BLAH_WEB_APPLICATION_NAME.XmlSerializers 它的依赖或之一。本 组件由一个运行时更新的建 比当前加载的运行时和 不能被加载
我们使用的是2008年被TFS下一个工作的MSBuild .proj文件(使用在生成定义升级模板)。只见这个问题和这一个,但那些提及使用特定SGEN生成步骤。我们不是。此外,提出的解决方案包括硬编码路径7.0A SGEN,这只是......难看。
We are using a msbuild .proj file that was working under TFS 2008 (using the "Upgrade Template" in the Build Definition). I saw this question and this one, but those mention using a specific SGen build step. We are not. Additionally, the proposed solution involve hard-coding the path to the 7.0A SGen, which is just...ugly.
有没有办法强制TFS 2010版本编译此XmlSerializers DLL作为.NET 3.5大会?
Is there a way to force the TFS 2010 build to compile this XmlSerializers DLL as a .Net 3.5 Assembly?
推荐答案
问题的根源是,在注册表中的值无效。在HKEY_LOCAL_MACHINE \ SOFTWARE的SDK35ToolsPath值\微软\的MSBuild \ ToolsVersions \ 4.0是:
The root problem was an invalid value in the registry. The SDK35ToolsPath value under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0 was:
$(注册表:HKEY_LOCAL_MACHINE \ SOFTWARE \微软\微软 的SDK \的Windows \ v7.0A \ WinSDK-NetFx35Tools 86 @ InstallationFolder)
但是,构建服务器有Windows SDK的7.1版本。所以,我修正值是:
However, the build server had Windows SDK version 7.1. So, I corrected the value to be:
$(注册表:HKEY_LOCAL_MACHINE \ SOFTWARE \微软\微软 的SDK \的Windows \ V7.1 \ WinSDKNetFx35Tools @ InstallationFolder)
然后XmlSerializers DLL是现在使用的.Net 2.0。
Then XmlSerializers DLL was now using .Net 2.0.
这篇关于TFS 2010中创建的.Net 4.0 XmlSerializers DLL对于.NET 3.5的应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!