I have an open source .NET project whose main artefact is a DLL that needs to be installed to the GAC for its primary use case. Therefore I want to install it during the AfterBuild task. I am using the GacUtil msbuild task from the MSBuild Community Extensions. It is not working.
My MSBuild code, which I got from here is:
<Target Name="AfterBuild">
<GacUtil Assemblies="$(TargetName)" />
</Target>
The command I am using is msbuild /t:AfterBuild /verbosity:diagnostic
. The error I get is:
Done building target "_CheckForInvalidConfigurationAndPlatform" in project "JustAProgrammer.ADPR.csproj".
Target "AfterBuild" in project "e:\src\JustAProgrammer.ADPR\JustAProgrammer.ADPR\JustAProgrammer.ADPR.csproj" (entry point):
Using "GacUtil" task from assembly "C:\Program Files (x86)\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.dll".
Task "GacUtil"
Done executing task "GacUtil" -- FAILED.
Done building target "AfterBuild" in project "JustAProgrammer.ADPR.csproj" -- FAILED.
Done Building Project "e:\src\JustAProgrammer.ADPR\JustAProgrammer.ADPR\JustAProgrammer.ADPR.csproj" (AfterBuild target(s)) -- FAILED.
I am executing this command from a copy of cmd.exe running as administrator with gacutil.exe in its path. I used this very same command prompt to successfully install and uninstall this assembly from the GAC, and double checked that the assembly is not in the c:\windows\assembly folder.
How do I figure out why GacUtil is failing?