安裝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」
您是否檢查每個錯誤所需的文件是否存在? 「請確保(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