.NET Framework Developer Center > .NET Development Forums > .NET Framework Setup > How To Install .NET Assembly Into GAC On Windows Server 2008
Ask a questionAsk a question
 

AnswerHow To Install .NET Assembly Into GAC On Windows Server 2008

  • Monday, June 30, 2008 10:03 AMJason Evans Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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.

Answers

All Replies

  • Wednesday, July 02, 2008 2:17 AMFigo FeiMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    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.
  • Thursday, January 08, 2009 3:27 PMNathan Phillips Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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?
  • Tuesday, January 13, 2009 10:00 PMPhilWilson Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I suspect the issue might be that you might not have write permissions to the GAC folder, even if you are administrator.
    Phil Wilson
  • Friday, January 16, 2009 2:26 PMTPaling Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer
    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 byTPaling Friday, January 16, 2009 2:26 PMAdd spacing.
    • Proposed As Answer byTPaling Friday, January 16, 2009 2:41 PM
    •  
  • Tuesday, January 20, 2009 7:46 PMmatte303 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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 bymatte303 Tuesday, January 20, 2009 8:01 PMupdate
    •  
  • Wednesday, January 21, 2009 2:57 AMFigo FeiMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer
    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
  • Saturday, August 29, 2009 6:57 PMbriane26 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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.
  • Wednesday, September 09, 2009 5:58 PMVidiot2008 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Microsoft.... always making it easier... one of a hundred examples.
  • Tuesday, November 03, 2009 10:44 AMBombastic Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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)