我在使用64位版本的機器上運行時出現MSBuild Community Tasks Project的Attrib任務問題。MSBuild.Community.Tasks.Attrib on x64機器故障
我已經把這個小測試項目顯示的問題是什麼:
<Project ToolsVersion="3.5" DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath32)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
<Target Name="PrintProperties">
<Message Text="MSBuildCommunityTasksPath: $(MSBuildCommunityTasksPath)"/>
<Message Text="MSBuildCommunityTasksLib: $(MSBuildCommunityTasksLib)"/>
<Message Text="MSBuildNodeCount: $(MSBuildNodeCount)"/>
<Message Text="MSBuildExtensionsPath: $(MSBuildExtensionsPath)"/>
<Message Text="MSBuildExtensionsPath32: $(MSBuildExtensionsPath32)"/>
<Message Text="MSBuildProjectDirectoryNoRoot: $(MSBuildProjectDirectoryNoRoot)"/>
<Message Text="MSBuildToolsPath: $(MSBuildToolsPath)"/>
<Message Text="MSBuildToolsVersion: $(MSBuildToolsVersion)"/>
<Message Text="MSBuildBinPath: $(MSBuildBinPath)"/>
<Message Text="MSBuildExtensionsPath: $(MSBuildExtensionsPath)"/>
<Message Text="MSBuildProjectDefaultTargets: $(MSBuildProjectDefaultTargets)"/>
<Message Text="MSBuildProjectDirectory: $(MSBuildProjectDirectory)"/>
<Message Text="MSBuildProjectExtension: $(MSBuildProjectExtension)"/>
<Message Text="MSBuildProjectFile: $(MSBuildProjectFile)"/>
<Message Text="MSBuildProjectFullPath: $(MSBuildProjectFullPath)"/>
<Message Text="MSBuildProjectName: $(MSBuildProjectName)"/>
<Message Text="MSBuildStartupDirectory: $(MSBuildStartupDirectory)"/>
</Target>
<Target Name="TestAttrib" DependsOnTargets="PrintProperties">
<Attrib Files="Test.txt" ReadOnly="false" />
</Target>
</Project>
當我嘗試建立使用TestAttrib作爲目標這個項目的MSBuild我得到下面的結果
C:> msbuild「C:_Source Code \ Test.vbproj」/ t:TestAttrib Microsoft(R)Build Engine版本3.5.30729.1 [Microsoft .NET Framework,版本2.0.50727.4016] 版權所有(C)Microsoft Corporation 2007。版權所有。
開始建造7/09/2009 2:50:12 PM。
節點0上的項目「C:_Source Code \ Test.vbproj」(TestAttrib target(s))。
MSBuildCommunityTasksLib:C:\ Program Files文件\的MSBuild \ MSBuildCommunityTasks \ MSBu ild.Community.Tasks.dll
MSBuildNodeCount:1
MSBuildExtensionsPath:C:\ Program Files文件\的MSBuild
MSBuildExtensionsPath32:C:\程序文件(x86 )\的MSBuild
MSBuildProjectDirectoryNoRoot:_Source代碼
MSBuildToolsPath:C:\ WINDOWS \ Microsoft.NET \ Framework64 \ v3.5版本
MSBuildToolsVersion:3.5
MSBuildBinPath:C:\ WINDOWS \ Microsoft.NET \ Framework64 \ V3.5
MSBuil dExtensionsPath:C:\ Program Files文件\的MSBuild
MSBuildProjectDefaultTargets:建立
MSBuildProjectDirectory:C:_Source代碼
MSBuildProjectExtension:.vbproj
MSBuildProjectFile:Test.vbproj
MSBuildProjectFullPath:C:_Source代碼\ Test.vbproj
MSBuildProjectName :測試
MSBuildStartupDirectory:C:\
C:_Source Code \ Test.vbproj(26,5):錯誤MSB4062:無法從程序集C:\ Program中加載「MSBuild.Community.Tasks.Attrib」任務FILES \的MSBuild \ MSBuildCommunityTasks \ MSBuild.Community.Tasks.dll。無法加載文件或程序集'file:/// C:\ Program Files \ MSBuild \ MSBuildCommunityTasks \ MSBuild.Community.Tasks.dll'或其某個依賴項。該系統找不到指定的文件。確認聲明是正確的,並且程序集及其所有依賴項都可用。 完成構建項目「C:_Source Code \ Test.vbproj」(TestAttrib target(s)) - 失敗。
構建失敗。 (TestAttrib target)(1) - >(TestAttrib target) - > C:_Source Code \ Test.vbproj(26,5):error MSB4062:「MSBuild。」 Community.Tasks.Attrib「任務無法從程序集C:\ Program Files \ MSBuild \ MSBuildCommunityTasks \ MSBuild.Community.Tasks.dll中加載。無法加載文件或程序集'file:/// C:\ Program Files \ MSBuild \ MSBuildCommunityTasks \ MSBuild.Community.Tasks.dll'或其某個依賴項。該系統找不到指定的文件。確認聲明是正確的,並且程序集及其所有依賴項都可用。
0 Warning(s)
1 Error(s)
時間已用00:00:00。05
當我使用(MSBuildExtensionsPath32)變量顯式導入任務時,爲什麼MSBuild在C:\ Program Files \ MSBuild \ MSBuildCommunityTasks \ MSBuild.Community.Tasks.dll中搜索Attrib任務?
有完全相同的問題,謝謝! – PatrickJ 2010-05-10 04:46:45