locked
Gacutil.exe Errors out w/ spaces in filepath

    Question

  • Everytime I use Gacutil.exe and specify a filepath w/ spaces in the name, the utility says it can't find the file specified.

     

    E.G.

    COMMAND

    -----------------

    C:\>gacutil /i GacUtilCL.dll /r FILEPATH "C:\Documents and Settings\bmackey\My D
    ocuments\Visual Studio 2005\Projects\GacUtilUI\GacUtilCL\bin\Debug\" "GAC Util"

     

    RETURNS

    ------------------
    Microsoft (R) .NET Global Assembly Cache Utility.  Version 2.0.50727.42
    Copyright (c) Microsoft Corporation.  All rights reserved.

                  SCHEME: <FILEPATH>  ID: <C:\Documents and Settings\bmackey\My Documents\Visual Studio 2005\Projects\GacUtilUI\GacUtilCL\bin\Debug" GAC>  DESCRIPTION : <Util>
    Failure adding assembly to the cache:   The system cannot find the file specified.

    Monday, January 14, 2008 8:28 PM

Answers

  • Hi,

     

    Regarding to the gacutil /?

     

    ...

    Options:
      /r <reference_scheme> <reference_id> <description>
        Specifies a traced reference to install (/i, /il) or uninstall (/u, /ul).
          <reference_scheme> is the type of the reference being added
            (UNINSTALL_KEY, FILEPATH or OPAQUE).
          <reference_id> is the identifier of the referencing application,
            depending on the <reference_scheme>
          <description> is a friendly description of the referencing application.
        Example: /r FILEPATH c:\projects\myapp.exe "My App"
    ...

     

    So, in your situation I think you have to use following command line:

     

    C:\>gacutil /i GacUtilCL.dll /r FILEPATH "C:\Documents and Settings\bmackey\My D
    ocuments\Visual Studio 2005\Projects\GacUtilUI\GacUtilCL\bin\Debug\GacUtilCL.dll" "GAC Util"

     

    Why don't you specify whole path right after /i attribute?

    Wednesday, January 16, 2008 4:08 PM
  • I tried the suggestion regarding full path + filename and it did not work.  I was using /i and /r simply because I was going by an example in the help file.  We did manage to fix the problem by your second suggestion, which is specifying the path after /i and not using /r.  This worked, not sure why /r doesn't do well w/ spaces in file path, but thats simply the way it is.
    Wednesday, January 16, 2008 4:42 PM

All replies

  • Hi,

     

    Regarding to the gacutil /?

     

    ...

    Options:
      /r <reference_scheme> <reference_id> <description>
        Specifies a traced reference to install (/i, /il) or uninstall (/u, /ul).
          <reference_scheme> is the type of the reference being added
            (UNINSTALL_KEY, FILEPATH or OPAQUE).
          <reference_id> is the identifier of the referencing application,
            depending on the <reference_scheme>
          <description> is a friendly description of the referencing application.
        Example: /r FILEPATH c:\projects\myapp.exe "My App"
    ...

     

    So, in your situation I think you have to use following command line:

     

    C:\>gacutil /i GacUtilCL.dll /r FILEPATH "C:\Documents and Settings\bmackey\My D
    ocuments\Visual Studio 2005\Projects\GacUtilUI\GacUtilCL\bin\Debug\GacUtilCL.dll" "GAC Util"

     

    Why don't you specify whole path right after /i attribute?

    Wednesday, January 16, 2008 4:08 PM
  • I tried the suggestion regarding full path + filename and it did not work.  I was using /i and /r simply because I was going by an example in the help file.  We did manage to fix the problem by your second suggestion, which is specifying the path after /i and not using /r.  This worked, not sure why /r doesn't do well w/ spaces in file path, but thats simply the way it is.
    Wednesday, January 16, 2008 4:42 PM
  • I know this is a bit of an old post, but I had some issues with the gacutil.exe and installing an assembly into the GAC, so I thought I would let everyone know what I did. I am using VS 2010 and the .NET 4.0 framework. It was pretty simple to add an assembly into the GAC.

    1. Open up VS2010 Command Prompt (Start > All Programs > Visual Studio 2010 > Visual Studio Tools > Visual Studio Command Prompt (2010))

    2. Type in the following: gacutil /i C:\mydirectory\MyDll.dll

    That should work and it should install properly. Hope this helps someone down the road!


    Ankit
    Friday, December 10, 2010 4:20 PM
  • It not proper answer, you are not going to install visual studio on the server. how do we do it on server any suggestions
    Be the Force With you
    Thursday, September 15, 2011 5:06 PM
  • If you are not using an installer (which you probably should for deploying to a server) and are looking to do this manually then you should be able to do this

    1) open explorer to %windir%\assembly; this will give you a 'special' view of the GAC

    2) drag your assemblies (which must be strong named by the way) from the stored location on disk into this folder 

    You can also remove them by deleting the ones you copy over 

    PS be careful; be very, very careful :)

    Thursday, September 15, 2011 10:02 PM
  • For anyone stumbling across this with a similar problem, I too had a similar issue when adding the dll from a network machine. With the source dll on a share mapped as a drive (G:\etc\etc\bin\Debug), it would not work.  However using the full UNC (\\servername\d$\sharedfolder\etc\etc\bin\Debug) it worked fine.

    Rab

    Tuesday, December 11, 2012 5:07 PM