locked
How To Install .NET Assembly Into GAC On Windows Server 2008 RRS feed

  • Question

  • Hi there.

    I have a .NET 2.0 assembly which has been used in many SharePoint projects, running on W2K3 boxes, which I'm having trouble installing on a W2K8 box. Normally, on a W2K3 box, I can get away with dragging the assembly into the C:\Windows\Assembly folder and it will be installed, no problem. However, I see that things are a bit different in W2K8!

    If I try to drag the assembly into the GAC, I get an error message indicating that I can't do that. Ok, so I ran Windows Explorer with 'Run As Administrator', but that made no difference.

    I looked for .Net Configuration in Control Panel, but that is not there.

    As a last resort I did a 'dir gacutil.exe /a/s/p' in a command prompt, but that returned nothing. There is no Visual Studio installed on the W2K8 box, thus I assume that's the reason for no gacutil.exe.

    So my questions is, what is the preferred method of installing an assembly into the GAC in W2K8? Has anyone else had the same problem?

    Thanks.
    Jas.
    Monday, June 30, 2008 10:03 AM

Answers

All replies

  • First of all ensure that you're getting administrator priviledge to install it into GAC. 
    and of course the assembly must have strong name as well.

    And FYI .NET Framework 2.0 SDK which includes gacutil.exe along with other .NET configuration tools: http://www.microsoft.com/downloads/details.aspx?FamilyID=fe6f2099-b7b4-4f47-a244-c96d69c35dec&displaylang=en

    Thanks.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Edited by Figo Fei Wednesday, July 2, 2008 2:26 AM strong name
    • Proposed as answer by Syed Abdul Rahman Wednesday, July 2, 2008 7:35 AM
    • Marked as answer by Figo Fei Friday, July 4, 2008 1:36 AM
    Wednesday, July 2, 2008 2:17 AM
  • This post didn't really answer the question. Is the answer that you can't install into the GAC without gacutil on Windows Server 2008?
    Thursday, January 8, 2009 3:27 PM
  • I suspect the issue might be that you might not have write permissions to the GAC folder, even if you are administrator.
    Phil Wilson
    Tuesday, January 13, 2009 10:00 PM
  • If, like me, you didn't want to install any extra tools or SDKS,  I finally found a (non-obvious) way of doing this using the traditional drag and drop method:


    1. Open a Command Prompt as Administrator (right click, Run As Administrator).
    2. Run "explorer C:\windows\assembly".
    3. Open a new explorer window from the window which just opened (Right click -> Open whilst holding Ctrl). I did this by hopping back up to C:\windows and the navigating to my assembly in the second (new) window.
    4. Navigate in the first windows back to C:\windows\assembly.
    5. Drag and drop between the two windows.



    Hope this helps someone.

    Tim

    • Edited by TPaling Friday, January 16, 2009 2:26 PM Add spacing.
    • Proposed as answer by TPaling Friday, January 16, 2009 2:41 PM
    Friday, January 16, 2009 2:26 PM
  • Thanks Tim, your post helped me.  I was looking for a way to delete a large number of assemblies from the GAC using Windows Explorer and the only way I'd found was to turn off UAC, reboot, delete the assemblies, then turn UAC back on and reboot again, not exactly convenient.

    What amazes me is that simply running Windows Explorer as Administrator doesn't work, even opening Explorer from the admin command window as you describe, but not specifying the path, then navigating to C:\Windows\assembly from within Explorer doesn't work! Very non-intuitive!  I hope this is better in Windows 7.

    UPDATE: I discovered that it does work to create a shortcut to Windows Explorer which includes the path to the GAC (Target: %SystemRoot%\explorer.exe C:\Windows\assembly), which you can then invoke via Right-click, Run as Administrator. I put one on my desktop and labeled it "GAC" for quick access.
    • Edited by matte303 Tuesday, January 20, 2009 8:01 PM update
    Tuesday, January 20, 2009 7:46 PM
  • To supplement my answer, to install assemblies into GAC we've got following ways:
    • Using the Global Assembly Cache tool (Gacutil.exe).
      Note: Gacutil.exe is only for development purposes and should not be used to install production assemblies into the global assembly cache. 
    • Using Microsoft Windows Installer 2.0.
      This is the recommended and most common way to add assemblies to the global assembly cache. The installer provides reference counting of assemblies in the global assembly cache, plus other benefits.
    • Using a Windows shell extension provided by the Windows Software Development Kit (SDK) called the Assembly Cache Viewer (Shfusion.dll).
      The shell extension allows you to drag assemblies into the global assembly cache.
    • Using the .NET Framework Configuration Tool (Mscorcfg.msc).
      The .NET Framework Configuration Tool (Mscorcfg.msc) allows you to view the global assembly cache and add new assemblies to the cache.

    The No.2 method is better for a deployment of a real product. And you can do this in Visual Studio setup project: How to deploy an assembly to the target computer global assembly cache (also applies for VS2005 and VS2008)

    Thanks.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help. http://forums.msdn.microsoft.com/en-US/vssetup/thread/60424309-bd78-4ca2-b618-03c4a16123b6
    • Proposed as answer by Figo Fei Wednesday, January 21, 2009 2:58 AM
    Wednesday, January 21, 2009 2:57 AM
  • I came here searching how to do this in Windows 7 rtm.  TPaling's response did not work for me, I suspect it will also not work in 2008 R2 either (no testing just guessing).  Of the four options in Figo's second response, installing the assembly using .Net Framework Configuration tool worked for me.
    Saturday, August 29, 2009 6:57 PM
  • Microsoft.... always making it easier... one of a hundred examples.
    Wednesday, September 9, 2009 5:58 PM
  • Hi,

    On Windows 2008 Server R2 I had to disable UAC to be able to drag and drop the dll into the assembly folder. (Tried with running explorer as administrator first but got access denied)

    Tuesday, November 3, 2009 10:44 AM
  • On Windows 7
    - There is no shfussion.dll
    - There is no Mscorcfg.msc
    - The GacUtil must be run in elevated mode. But I was not very successful with that as well.

    At least when you cannot get things in the GAC it is all secure. Only thing is that for BizTalk assemblies MUST BE in the GAC.
     
    Wednesday, February 3, 2010 3:15 AM
  • One thing that's tripped us up in the past when exploring this feature
    http://types-of-snakes.blogspot.com/
    Saturday, March 20, 2010 6:21 AM
  • If, like me, you didn't want to install any extra tools or SDKS,  I finally found a (non-obvious) way of doing this using the traditional drag and drop method:


    1. Open a Command Prompt as Administrator (right click, Run As Administrator).
    2. Run "explorer C:\windows\assembly".
    3. Open a new explorer window from the window which just opened (Right click -> Open whilst holding Ctrl). I did this by hopping back up to C:\windows and the navigating to my assembly in the second (new) window.
    4. Navigate in the first windows back to C:\windows\assembly.
    5. Drag and drop between the two windows.

    Karthi K, Infy - India.
    Saturday, March 20, 2010 8:17 AM
  • For Windows Server 2008:

     

    1. Create a shortcut to Windows\assembly  folder. 
    2. in the target field point the cursor at the the beginning and type: %SystemRoot%\expolrer.exe <rest of the path to assembly folder>
    3. Create a second shortcut in the same way to the  folder where your assembly is residing that you want to install.
    4. Right Click the shortcut for the assembly folder and select "Run as Administrator".
    5. do step 4 for the second shortcut.
    6. now both folders have been opened under Administrator.
    7. just drag and drop assemblies between the opened windows. and you are done.
    Sunday, May 23, 2010 7:27 AM
  • Its easy using Explorer or gacutil.exe , but someone knows how I can do this in Windows server core 2008 R2 ? .

    Whitout Explorer and gacutil.

    I tried with xcopy , but does not work.

     

     

    Monday, June 7, 2010 6:20 PM
  • Here's the answer, it is UAC-related, but you may have to change the Local Access Policy around UAC as well -- this worked for me:


    http://blogs.msdn.com/b/mossbiz/archive/2010/06/10/add-an-assembly-to-the-global-assembly-cache-on-windows-server-2008-r2.aspx

    Friday, June 18, 2010 11:19 PM
  • Welldone TPaling.

    It's realy works.Thanks a lot.

    Wednesday, September 29, 2010 6:10 AM
  • Hi there.

    I have a .NET 2.0 assembly which has been used in many SharePoint projects, running on W2K3 boxes, which I'm having trouble installing on a W2K8 box. Normally, on a W2K3 box, I can get away with dragging the assembly into the C:\Windows\Assembly folder and it will be installed, no problem. However, I see that things are a bit different in W2K8!

    If I try to drag the assembly into the GAC, I get an error message indicating that I can't do that. Ok, so I ran Windows Explorer with 'Run As Administrator', but that made no difference.

    I looked for .Net Configuration in Control Panel, but that is not there.

    As a last resort I did a 'dir gacutil.exe /a/s/p' in a command prompt, but that returned nothing. There is no Visual Studio installed on the W2K8 box, thus I assume that's the reason for no gacutil.exe.

    So my questions is, what is the preferred method of installing an assembly into the GAC in W2K8? Has anyone else had the same problem?

    Thanks.
    Jas.

    Wednesday, September 29, 2010 6:31 AM
  • Hi all,

    If you do not want to install/copy GACUTIL you can use PowerShell to install assemblies into the GAC.

    Ref: PowerShell: Install-Gac (GACUTIL for PowerShell)

    Wednesday, March 30, 2011 8:42 AM
  • If, like me, you didn't want to install any extra tools or SDKS,  I finally found a (non-obvious) way of doing this using the traditional drag and drop method:


    1. Open a Command Prompt as Administrator (right click, Run As Administrator).
    2. Run "explorer C:\windows\assembly".
    3. Open a new explorer window from the window which just opened (Right click -> Open whilst holding Ctrl). I did this by hopping back up to C:\windows and the navigating to my assembly in the second (new) window.
    4. Navigate in the first windows back to C:\windows\assembly.
    5. Drag and drop between the two windows.



    Hope this helps someone.

    Tim

    The "hopping back" part seems to be crucial as well.  I first tried opening that second window by using any of the possibilities in the treeview part of Explorer, on Computer for instance.  But alas, that didn't work out.  Need to hop back first, then open a second window by clicking on a real folder.

    Most useful post in this whole thread, should have been marked as Answer!  Thanks!


    MCITP SQL Server 2008 (DEV); MCTS SQL Server 2008 (BI, DEV & DBA)
    Wednesday, June 29, 2011 11:35 AM
  • This was exactly what I was looking for - thanks!
    Thursday, July 28, 2011 4:14 PM
  • I tried everything in this thread with no luck (including the shortcut technique).

    There is something totally different about Server 2008 R2 and no one seems to have the answer. I have only one thing left to try which is defeat UAC completely somehow.

    No errors are logged. When you drag and drop to the GAC, you get the copy + sign, but it does nothing.

    Note that I have also tried the comand prompts for Visual Studio in both the 32 bit and 64 bit version and run gacutil in both. Both say they installed successfully but if you examine the refreshed assembly or the .NET 4.0 Microsoft.Net\assembly folder, you find no DLL's in any folder even though in the case of some DLL's it actually created the folder structure, just did not put a DLL in the folder.

    So I am still surfing the net looking for some documentation that works.

    Tuesday, August 9, 2011 9:56 PM
  • Try with this work-around (it works for me):

    a.     Open a CMD console ad administrator (right-click on CMD, then run-as-administrator)

    b.     in cmd launch this command  "subst g: %windir%\assembly\gac_msil"

    c.     now launch this command “explorer G:” which will open you a new explorer window

    d.     Copy DLL to the new explorer window give CONTINUE answer to the warning that will appears on your screen.

    Ciao, emanuele.

     

    Thursday, August 11, 2011 12:43 PM
  • I had similar problems with Windows Server 2008 R2, in the end I solved the issue by installing using PowerShell. There's a good couple of functions at this blog entry http://fredericloud.com/2011/01/08/no-gacutil-no-problem/

    Cheers,

    Colin

    Tuesday, August 16, 2011 9:34 AM
  • Try this =).....

    THIS IS FOR SERVER 2008, VISTA AND WINDOWS 7!

     

    WHAT THE BELOW DOES....following the following instructions below, will allow you to be logged into your windows environment with complete administrative permissions; allowing you to do anything like in the XP days =)

     

    ! before doing anything at all, make sure you read the entire section...this is to make sure all "methods/options" are still available

     

    1. kill explorer shell (there are many different ways to do this - see below)

     *taskmgr > right click explorer.exe > end process

     *command prompt > [taskkill /F /IM "explorer.exe"]

     *shift+right click on start button > kill explorer

     

    2. now with the task manager open, open up the explorer shell with elevated privileges (see below)

    *to open up task manager, you can hold the keys CTRL+SHIFT+ESC

    *you can either A. go to the taskmgr menu and select new process OR B. you can go to the "new process" button THEY ARE THE SAME

    *before hitting enter, make sure the [run with elevated privileges] is checked

     

    That's it.


    Friday, August 26, 2011 10:34 PM
  • If, like me, you didn't want to install any extra tools or SDKS,  I finally found a (non-obvious) way of doing this using the traditional drag and drop method:


    1. Open a Command Prompt as Administrator (right click, Run As Administrator).
    2. Run "explorer C:\windows\assembly".
    3. Open a new explorer window from the window which just opened (Right click -> Open whilst holding Ctrl). I did this by hopping back up to C:\windows and the navigating to my assembly in the second (new) window.
    4. Navigate in the first windows back to C:\windows\assembly.
    5. Drag and drop between the two windows.

    Karthi K, Infy - India.
    Unfortunately this didn't work on neither Windows 7 nor WS2008. I drag and drop, but nothing happens.
    Friday, October 21, 2011 2:31 PM
  • A bit obsolete information.

    Microsoft has abbandoned mscorconfig.msc and shfusion.dll for .NET framework 4.0, and recomends to use gacutil.exe for assembly installations:

    http://msdn.microsoft.com/en-us/library/34149zk3.aspx

    http://msdn.microsoft.com/en-us/library/2bc0cxhc.aspx

     


    • Edited by UldisV Monday, November 28, 2011 1:06 PM
    • Proposed as answer by Sai U Friday, April 20, 2012 7:34 AM
    Monday, November 28, 2011 1:04 PM
  • its secure alright


    Mike

    Wednesday, May 23, 2012 5:17 PM
  • Try this =).....

    THIS IS FOR SERVER 2008, VISTA AND WINDOWS 7!

     

    WHAT THE BELOW DOES....following the following instructions below, will allow you to be logged into your windows environment with complete administrative permissions; allowing you to do anything like in the XP days =)

     

    ! before doing anything at all, make sure you read the entire section...this is to make sure all "methods/options" are still available

     

    1. kill explorer shell (there are many different ways to do this - see below)

     *taskmgr > right click explorer.exe > end process

     *command prompt > [taskkill /F /IM "explorer.exe"]

     *shift+right click on start button > kill explorer

     

    2. now with the task manager open, open up the explorer shell with elevated privileges (see below)

    *to open up task manager, you can hold the keys CTRL+SHIFT+ESC

    *you can either A. go to the taskmgr menu and select new process OR B. you can go to the "new process" button THEY ARE THE SAME

    *before hitting enter, make sure the [run with elevated privileges] is checked

     

    That's it.



    The only solution that really worked on 2008 R2 server.
    You saved the day! Thank You!
    Thursday, February 13, 2014 12:29 PM
  • The marked answar didn't really help me out. I found that Powsershell is a really easy way to do this.

    Please see this post for steps to install DLL in GAC using Powershell: Install DLL in GAC without GACUtil


    http://technicaltrix.blogspot.dk/

    Saturday, October 25, 2014 9:54 AM