In Visual Studio 2010, using the Post Build Event to install your dll into the GAC, you might run into the problem of receiving an error similar to the subject line:

The command "gacutil.exe -i (YourDLL) exited with code 9009 (or Code 1).

There are a lot of “solutions” out there on the web when you search, and I found that a combination of all of them worked.

  • First, put the path to your Gacutil.exe in your PATH Environment variables value.
  • Next, make sure that your Visual Studio Command Prompt and Visual Studio links are set to ‘Run as Administrator’
  • Finally, in the PostBuild Event, put in the following:
  • gacutil.exe -if "$(TargetPath)"

The ‘i’ installs the dll. the ‘f’ forces it (if a previous version is already installed). AND – make sure the double quotes around $(TargetPath) are included.

This fixed it for me and I hope it fixes it for you.