locked
gacutil.exe is not recognized as an internal or external command, RRS feed

  • Question

  • I am building my project to insert a feature I developed into MOSS but my GACUTIL is giving me this error:

    '"c:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe"' is not recognized as an internal or external command,

    on my build. Do I have to add the GACUTIL as a Environment variable? My dll does not get created for my feature due to this.

    Victor Palma
    • Moved by Mike Walsh FIN Wednesday, August 6, 2008 3:48 AM Better forum (Moved from SharePoint - General Question and Answers and Discussion to SharePoint - Development and Programming)
    Tuesday, August 5, 2008 8:04 PM

Answers

  • To copy the .dll to the GAC folder, use this commandline:

    xcopy "C:\wherever_your_assembly_is\YourAssembly.dll" "C:\Windows\assembly\" /y /e

    (Or simply drag'n'drop your .dll into that folder, should do the trick aswell)

    If any of the above doesn't work, it means you don't have permissions to the folder.
    Tobias Zimmergren
    Tobias Zimmergren's thoughts on development
    Wednesday, August 6, 2008 5:58 PM
  • Ugh! I don't have the .NET 2.0 SDK installed on the development environment which is the reason that the gacutuil.exe file is not there. The gacutil.exe did ship with the 1.1 version reason it exists there but not on the 2.0 framework. I have to install the 2.0 SDK to get this tool. Thanks guys!
    Victor Palma
    • Marked as answer by Victor Palma Thursday, August 7, 2008 6:25 PM
    Thursday, August 7, 2008 6:25 PM

All replies

  • If you add it to the environmental variables (PATH) you must close Visual Studio and then open it again, if you havn't done that.

    Part from that, you could always set the path as a variable in your post-build and then use that variable, like so:

    SET gacutility = "C:\Program Files\Microsoft.....\gacutil.exe" 
     
    %gacutility% -i MyAwesomeAssembly.dll 

    Hope this helps,

    Regards,
    Tobias Zimmergren
    Tobias Zimmergren's thoughts on development
    Tuesday, August 5, 2008 8:50 PM
  • I added the GACUTIL.EXE file that is under the

    C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\

    directory under:

    Right click My Computer > Properties > Advanced tab> Environment Variables > Looked for the System Variable 'PATH' > Added my Semicolon seperated reference with that directory (;C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\)

    I still cannot get my project to recognize the GACUTIL utility. I also tried the command prompt and no can do. Anything wrong here?

    Victor Palma
    Tuesday, August 5, 2008 10:42 PM
  • >I am building my project to insert a feature I developed i

    Moving to programming.

    Please post programming questions directly there.
    Wednesday, August 6, 2008 3:47 AM
  • Victor,

    If you navigate to "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin" in your cmd.exe console, and then enter "gacutil.exe" you should be able to use the tool. If all you get is the "is not recognized as an internal or external command", then you should make sure that you've got the gacutil.exe utility in that folder, for sure.

    Did you try to reboot your system (really you're only required to reboot Visual studio and your cmd.exe consoles you've got open in order for a new path variable to work)


    Anyhow, conclusion: Use this path "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin;" in your PATH variables, and reboot to make sure you've got all the required applications restarted...

    If it still doesn't work, consider repairing your .NET framework install, as this isn't really a SharePoint problem.


    Tobias Zimmergren
    Tobias Zimmergren's thoughts on development
    Wednesday, August 6, 2008 5:53 AM
  • Tobias,

    I do see the gacutil.exe file under the following directory:

    C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\

    but not on:

    C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin

    Is this really a .NET framework installation issue? Perhaps I am missing one of the SDK installs?



    Victor Palma
    Wednesday, August 6, 2008 6:26 AM
  • What I simply was trying to do is build  a feature into the bin folder within SharePoint. I simply created a variable within a batch file that has the directory hardcoded so I can place it in the GAC.

    @SET GACUTIL="c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\gacutil.exe"


    Victor Palma
    Wednesday, August 6, 2008 6:37 AM
  • Ugh! It wont place my assembly on the GAC with that directory. I get:

    Failure adding assembly to the cache: Unknown Error

    When building my class library. Does it really matter where the gacutil.exe reside?


    Victor Palma
    Wednesday, August 6, 2008 6:45 AM
  • Do this instead: Copy your .dll file to "C:\Windows\Assembly",  and it will automatically be added to the cache.

    As the problem isn't really related to SharePoint, I'm going to stop here.

    Hope this helps
    Regards,
    Tobias Zimmergren
    Tobias Zimmergren's thoughts on development
    Wednesday, August 6, 2008 8:50 AM
  • Hey Tobias,

    Thanks for all your help. Unfortunately, the C:/Windows/Assembly/ folder wont allow me to see any copy features. I was trying to copy that gacutil.exe file.

    Yes, I do understand this is not a SharePoint issue but it would help future related issues regarding the matter. Regardless, thank you! :)

    Victor Palma
    • Edited by Victor Palma Wednesday, August 6, 2008 3:07 PM I mispelled a word
    Wednesday, August 6, 2008 3:06 PM
  • You need to use the version of gacutil that ships with VS 2005.  You can do that by setting your PATH environment variable to match what is set when you open a Visual Studio 2005 Command Prompt.  Check the vcvars32.bat file to determine the correct path. 

    As a quick test, you can simply open a VS 2005 Command Prompt and type "gacutil".  If it fails to run, then you may need to reinstall VS 2005 or download and install the VS 2005 SDK.  If it finds the program, then setting the path should work.  Remember to exit and restart Visual Studio.
    John Holliday, MVP Office SharePoint Server
    Wednesday, August 6, 2008 3:15 PM
  • To copy the .dll to the GAC folder, use this commandline:

    xcopy "C:\wherever_your_assembly_is\YourAssembly.dll" "C:\Windows\assembly\" /y /e

    (Or simply drag'n'drop your .dll into that folder, should do the trick aswell)

    If any of the above doesn't work, it means you don't have permissions to the folder.
    Tobias Zimmergren
    Tobias Zimmergren's thoughts on development
    Wednesday, August 6, 2008 5:58 PM
  • Ugh! I don't have the .NET 2.0 SDK installed on the development environment which is the reason that the gacutuil.exe file is not there. The gacutil.exe did ship with the 1.1 version reason it exists there but not on the 2.0 framework. I have to install the 2.0 SDK to get this tool. Thanks guys!
    Victor Palma
    • Marked as answer by Victor Palma Thursday, August 7, 2008 6:25 PM
    Thursday, August 7, 2008 6:25 PM