问题描述
我在安装MSVS 11Beta后遇到了编译问题,我的MSVS 10。现在,当我编译我的C#项目在MSVS 10(在MSVS 10创建的项目,目标框架:3.5),我得到的错误 MSB4216
, MSB4028
在输出窗口中下面的文字:
1>任务GenerateResource跳过,因为虚假的条件; (%(EmbeddedResource.Type)'=='的Resx和%(EmbeddedResource.GenerateResource)'!='假'和'$(GenerateResourceMSBuildRuntime)'!='CLR2')被评价为('的Resx'== 的Resx'和''!='假'和'CLR2'!='CLR2')。
1>任务GenerateResource
1>启动任务GenerateResource汇编Microsoft.Build.Tasks.v3.5,版本= 3.5.0.0,文化=中性公钥= b03f5f7f11d50a3a在外部任务主机CLR2的运行时间和过程的建筑86。
1> C:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \ Microsoft.Common.targets(2199,5):错误MSB4216:无法运行GenerateResource的任务,因为我们无法创建或连接到一个任务主机与运行CLR2和建筑中的x86。请确保(1)请求的运行时和/或体系结构可在机器上,和(2),所需的可执行文件C:\ Program Files文件(x86)的\微软的SDK \的Windows \ v8.0A \ BIN \ NETFX 4.0 TOOLS \ MSBuildTaskHost.exe的存在。
1以及c:\的Windows \ Microsoft.NET \框架\ v4.0.30319 \ Microsoft.Common.targets(2217,7):错误MSB4028:而GenerateResource任务的输出不能从FilesWritten参数检索。对象不目标类型匹配。
1>完成执行任务GenerateResource - 失败。
我该如何解决这些错误?
修改
- 中提到的文件。C:\ Program Files文件(x86)的\微软的SDK \的Windows \ v8.0A \ BIN \ NETFX 4.0 TOOLS \ MSBuildTaskHost.exe的存在
- 在C ++项目compling没有问题。
- 在重新安装VS10没有解决不了的问题。
- 这是
GenerateResource
任务,必须编译RESX文件,但会产生一个异常:
<! - 但是,我们不能使用这些参数,如果我们针对3.5,因为我们使用的是3.5的任务 - >
< GenerateResource
来源=@(EmbeddedResource)
UseSourcePath =$(UseSourcePath)
参考=@(ReferencePath)
AdditionalInputs =$(MSBuildAllProjects)
NeverLockTypeAssemblies =$(GenerateResourceNeverLockTypeAssemblies)
状态文件=$(IntermediateOutputPath)$(MSBuildProjectFile).GenerateResource.Cache
StronglyTypedClassName =%(EmbeddedResource.StronglyTypedClassName)
StronglyTypedFileName =%(EmbeddedResource.StronglyTypedFileName)
StronglyTypedLanguage =%(EmbeddedResource.StronglyTypedLanguage)
StronglyTypedNamespace =%(EmbeddedResource.StronglyTypedNamespace)
StronglyTypedManifest preFIX =%(EmbeddedResource.StronglyTypedManifest preFIX)
PublicClass =%(EmbeddedResource.PublicClass)
OutputResources="@(EmbeddedResource->'$(IntermediateOutputPath)%(ManifestResourceName).resources')"
MSBuildRuntime =$(GenerateResourceMSBuildRuntime)
MSBuildArchitecture =$(GenerateResourceMSBuildArchitecture)
条件=!%(EmbeddedResource.Type)'=='的Resx和%(EmbeddedResource.GenerateResource)'='假'和'$(GenerateResourceMSBuildRuntime)'=='CLR2'>
- 我试图debug的MSBuild脚本(
.csproj的
)。就在致命的GenerateResource
任务,我检查了所有的属性的和之前的项目的。没有什么关于8.0A,但只有7.0A
有一种丑陋的方式来解决这个问题:重命名文件夹C:\ Program Files文件(x86)的\微软的SDK \的Windows \ v8.0A
。我不想接受这个答案。
I ran into compilation problems with my MSVS 10 after installing MSVS 11Beta. Now, when I compile my C# Projects in MSVS 10 (Projects created in MSVS 10; Target framework: 3.5), I get errors MSB4216
, MSB4028
with following text in output window:
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.
How can I fix these errors?
EDIT:
- Mentioned file "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NetFX 4.0 Tools\MSBuildTaskHost.exe" exists.
- C++ projects are compling without problems.
- Reinstalling VS10 doesn't solve the problem.
- This is
GenerateResource
task, that must compile resx-file, but generates an exception:
<!-- 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'">
- I tried to debug MSBuild script (
.csproj
). Just before the fatalGenerateResource
task I checked all the properties and items. There was nothing about "8.0A" but only about "7.0A"
There is an ugly way to fix the problem: renaming folder "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A"
. I hate to accept this answer.
这篇关于貌似MSVS 11.0测试版宠坏一个MSVS 10.0安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!