看起来像MSVS 11.0 Beta破坏了MSVS 10.0安装
安装MSVS 11Beta后,我遇到了我的MSVS 10的编译问题。现在,当我编译我的C#项目在MSVS 10(MSVS 10创建的项目;目标框架:3.5),我得到的错误MSB4216
,MSB4028
与以下输出窗口中的文本:看起来像MSVS 11.0 Beta破坏了MSVS 10.0安装
1>Task "GenerateResource" skipped, due to false condition; ('%(EmbeddedResource.Type)' == 'Resx' and '%(EmbeddedResource.GenerateResource)' != 'false' and '$(GenerateResourceMSBuildRuntime)' != 'CLR2') was evaluated as ('Resx' == 'Resx' and '' != 'false' and 'CLR2' != 'CLR2').
1>Task "GenerateResource"
1> Launching task "GenerateResource" from assembly "Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" in an external task host with a runtime of "CLR2" and a process architecture of "x86".
1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2199,5): error MSB4216: Could not run the "GenerateResource" task because we could not create or connect to a task host with runtime "CLR2" and architecture "x86". Please ensure that (1) the requested runtime and/or architecture are available on the machine, and (2) that the required executable "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NetFX 4.0 Tools\MSBuildTaskHost.exe" exists.
1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2217,7): error MSB4028: The "GenerateResource" task's outputs could not be retrieved from the "FilesWritten" parameter. Object does not match target type.
1>Done executing task "GenerateResource" -- FAILED.
我怎样才能解决这些错误?
编辑:
- 提到文件的 “C:\ Program Files文件(x86)的\微软的SDK \的Windows \ v8.0A \ BIN \ NETFX 4.0工具\ MSBuildTaskHost.exe” 的存在。
- C++项目没有问题。
- 重新安装VS10不能解决问题。
- 这是
GenerateResource
任务,必须编译RESX文件,但产生的异常:
<!-- But we can't use those parameters if we're targeting 3.5, since we're using the 3.5 task -->
<GenerateResource
Sources="@(EmbeddedResource)"
UseSourcePath="$(UseSourcePath)"
References="@(ReferencePath)"
AdditionalInputs="$(MSBuildAllProjects)"
NeverLockTypeAssemblies="$(GenerateResourceNeverLockTypeAssemblies)"
StateFile="$(IntermediateOutputPath)$(MSBuildProjectFile).GenerateResource.Cache"
StronglyTypedClassName="%(EmbeddedResource.StronglyTypedClassName)"
StronglyTypedFileName="%(EmbeddedResource.StronglyTypedFileName)"
StronglyTypedLanguage="%(EmbeddedResource.StronglyTypedLanguage)"
StronglyTypedNamespace="%(EmbeddedResource.StronglyTypedNamespace)"
StronglyTypedManifestPrefix="%(EmbeddedResource.StronglyTypedManifestPrefix)"
PublicClass="%(EmbeddedResource.PublicClass)"
OutputResources="@(EmbeddedResource->'$(IntermediateOutputPath)%(ManifestResourceName).resources')"
MSBuildRuntime="$(GenerateResourceMSBuildRuntime)"
MSBuildArchitecture="$(GenerateResourceMSBuildArchitecture)"
Condition="'%(EmbeddedResource.Type)' == 'Resx' and '%(EmbeddedResource.GenerateResource)' != 'false' and '$(GenerateResourceMSBuildRuntime)' == 'CLR2'">
- 我试图debug的MSBuild脚本(
.csproj
)。就在致命GenerateResource
任务之前,我检查了所有属性和项目。没有什么关于“8.0A”,但只有大约“7.0A”
在MSDN论坛上提出了一个类似的问题。安装VS11后你重新启动了吗?
http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/7d955d96-ff73-47d3-8830-85ea321eb4ab
不,我装了VS11一个月前 – Loom 2012-04-20 15:17:02
您的用户名有多长?
当用户名长度为20个字符时,似乎有一个错误。如果您的用户名是19个字符或更少,它可以正常工作。
我在connect上打开了一个问题。
编辑: 您是否尝试过的环境变量DisableOutOfProcTaskHost
设置为true,如连接问题,这对我的工作建议。
安装VS2010并安装.NET Framework 4.5后,我的TFS 2010构建服务器上出现此问题。这使我可以构建.NET 4.5项目,但任何针对CLR2(.NET 2.0 -3.5)的VS2008项目,我尝试构建都会返回错误。在少数网站上关于这个问题的建议都没有奏效。
- 重启 - 没有解决问题
- 在一个环境变量,也是在项目文件中设置DisableOutOfProcTaskHost =真 - 没修好
- 我生成账户的用户名已经不到20个字符的问题
- 重命名Windows SDK文件夹 - N/A,因为我没有安装VS2012和8.0A SDK ...只是.NET框架4.5。
在任何情况下,为了解决这个问题,我卸载了.NET 4.5,修复了VS2010,然后重新启动了构建服务器。现在我可以毫无问题地构建VS2008和VS2010项目。
幸运的是,我不再需要构建.NET 4.5项目,因为该团队决定返回到.NET 4.0。
另一个可能的解决方法是将项目的目标框架更改为.Net 4.0。这并不总是一个解决方案,但如果一切都失败了,那肯定有可能。
为我工作:删除有问题的文件夹中的bin和OBJ文件夹,重新启动的解决方案
就我而言,我试图建立一个32位的Windows 7机器上的解决方案时收到错误消息。解决错误的方法是右键单击项目,选择属性,然后转到生成选项卡。在这里,我将“平台目标”从“任何CPU”改为“x86”。 HTH
设置设置DisableOutOfProcTaskHost = true
在一个环境变量为我工作。
您是否检查每个错误所需的文件是否存在? “请确保(1)机器上提供了所需的运行时和/或体系结构,以及(2)所需的可执行文件”C:\ Program Files(x86)\ Microsoft SDK \ Windows \ v8.0A \ bin \ NetFX 4.0 Tools \ MSBuildTaskHost.exe“存在。” – Chris 2012-04-20 13:38:58
@Chris - 是的,该文件存在,我可以在procmon日志中看到该应用程序“C:\ Program Files(x86)\ Microsoft SDKs \ Windows \ v8.0A \ bin \ NetFX 4.0 Tools \ MSBuildTaskHost.exe”正在执行一些操作。 – Loom 2012-04-20 13:53:18
这可能是一个路径问题。 VS11可能已经设置了一条覆盖生成脚本假定的路径的路径,并且使用了错误版本的文件或dll。检查你的路径。 – 2012-04-20 14:31:53