Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gacutil postbuild event exists with code 1

I am trying to register and assembly in the GAC on a post-build event. Here's my post-build command

"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\x64\gacutil.exe" /if "$(TargetPath)"

I am on x64/Windows 7/VS2010. I am running VS2010 as an administrator and I have UAC turned off (which is pretty much all that my google-fu is finding for this problem).

The post build is exiting with code 1 for the all 4 instances of gacutil.exe I can find on my machine.

Anyone know a way around this? Thanks in advance.

like image 832
JMorgan Avatar asked Jul 11 '11 20:07

JMorgan


People also ask

How do I get Gacutil EXE?

In Windows 7 - Choose Start, expand All Programs, and then expand Microsoft Visual Studio. Depending on the version of Visual Studio you have installed, choose Visual Studio Tools, Visual Studio Command Prompt, or the command prompt you want to use.

Where is Gacutil on Windows Server?

The Gacutil.exe tool is located in the . NET Framework installation directory. The default location for this is C:\Program Files (x86)\Microsoft SDKs\Windows\v10.


5 Answers

Copy the full post-build event command string (e.g. ""C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\x64\gacutil.exe" /if "D:\ProjectFolder\Project.Name\bin\Debug\Project.Name.dll" to the clip board, open a command prompt as an administrator, paste the post-build event, and press enter to execute. You'll get a more descriptive explanation of the exit code.

In my case, I had my project set to build to the wrong target framework. I switched it from .Net 4 to .Net 3.5 and the error went away.

Best of luck

like image 155
rjsidler Avatar answered Oct 04 '22 09:10

rjsidler


SOLUTION:

Try to run Visual Studio as ADMIN to install things in GAC... :)

like image 20
Eduardo Ridao Pérez Avatar answered Oct 04 '22 07:10

Eduardo Ridao Pérez


Mine is usually solved by iisreset.

like image 40
bresleveloper Avatar answered Oct 04 '22 08:10

bresleveloper


Looks like your post build script is incorrect....Try using "$(DevEnvDir)....\SDK\v2.0\Bin\GacUtil.exe" /i "$(TargetPath)" /f

like image 36
Vinay Avatar answered Oct 04 '22 08:10

Vinay


OS: Windows server 2012

.Net frame work 4.5

The path needs to be: C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\gacutil.exe

like image 30
user849169 Avatar answered Oct 04 '22 08:10

user849169