msbuildtasks
msbuildtasks copied to clipboard
error MSB4062: The "MSBuild.Community.Tasks.GacUtil" task could not be loaded from the assembly \MSBuild.Community.Tasks.dll))
Hello.
I am using latest version of MSBuild.Community.Tasks - v1.4.0.73 When I try to build project with MSBUILD tools version 3.5:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">)
which uses something like this:
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" Condition=" Exists('$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets') "/>
...
<MSBuild.Community.Tasks.GacUtil Command="Uninstall" Assemblies="Mono.Security" ContinueOnError="true"/>
then error occurs:
[(...)\publish.proj.teamcity] Building with tools version "3.5".
(...)
[19:34:54][(...)\publish.proj.teamcity] Run
[19:34:54][Run] Using "Message" task from assembly "Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
[19:34:54][Run] MSBuildExtensionsPath: C:\Program Files (x86)\MSBuild
[19:34:54][Run] MSBuildToolsPath: C:\Windows\Microsoft.NET\Framework\v3.5
(...)
[19:34:54][Run] Using "CallTarget" task from assembly "Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
[19:34:54][Run] CallTarget
[19:34:54][CallTarget] CleanGacFromLocalReferences
[19:34:54][CleanGacFromLocalReferences] (...)\publish.proj(67, 5): error MSB4062: The "MSBuild.Community.Tasks.GacUtil" task could not be loaded from the assembly \MSBuild.Community.Tasks.dll)). Could not load file or assembly 'file:///C:\MSBuild.Community.Tasks.dll))' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, and that the assembly and all its dependencies are available.
[19:34:54][(...)\publish.proj.teamcity] Project (...)\publish.proj.teamcity failed.
As you can see MSBUILD could not find GacUtil because it could not load MSBuild.Community.Tasks.dll
I think it is because of this line:
<MSBuildCommunityTasksLib>$([MSBUILD]::Unescape($(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.dll))</MSBuildCommunityTasksLib>
in %SystemDrive%Program Files (x86)\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets
MSBuildCommunityTasksLib is not evaluated correctly in MSBUILD Tools v3.5 due to ([MSBUILD]::Unescape (http://msdn.microsoft.com/en-us/library/dd633440(v=vs.100).aspx) which probablu is not available in 3.5
[MSBUILD]::Unescape has been added here: https://github.com/loresoft/msbuildtasks/commit/46fba5bc134704f5cf5a059aa445a88a2b34056c
Is it possible to made it work when using MSBUILD Tools version 4.x AND MSBUILD Tools version 3.5?
[MSBUILD]::Unescape
also does not appear to work under xbuild