38

I've been searching for a while trying to understand this better, but am not finding any straight-forward answers on this.

I have a component that I need to add to the GAC. I'm running Windows 7 64-bit, and in an effort to troubleshoot an issue (SSIS 2005 isn't recognizing the DLL), I'm trying to make sure I have the DLL (.NET 4.0) registered in the proper GAC.

So here are my questions:

  1. Where are the physical locations in Windows 7 for both 64bit and 32bit GACs? I know of C:\Windows\assembly, but not sure which one this is, and where the other one is.

  2. Which version of gacutil do I use to add an assembly to 64bit GAC? 32bit GAC? I know of C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC, and I'm assuming this is for 32bit, but not sure where 64bit gacutil is.

  3. What determines which GAC an application looks in for the assembly? I'm assuming this is determined by whether the app is 64bit or 32bit, but am wondering if there is more to it than that.

Thanks in advance.

Update:

After digging into this following ShaneBlake's answer, I remembered that .NET 2.0 and .NET 4.0 GACs are in different locations. So:

.NET 2.0 GAC:
c:\windows\assembly (32bit and 64bit?)

.NET 4.0 GAC
c:\windows\Microsoft.NET\assembly\GAC_32 (32bit only)
c:\windows\Microsoft.NET\assembly\GAC_64 (64bit only)
c:\windows\Microsoft.NET\assembly\GAC_MSIL (32bit & 64bit?)

Jerad Rose
  • 15,235
  • 18
  • 82
  • 153
  • Note that you can't use gacutil on client machines if you're distributing your app. VS installer/deployment projects will let you install the assemblies in the correct location. – 3Dave Jun 28 '11 at 14:32

2 Answers2

23

The gacutil.exe should install the .dll to the right location depending on how it was compiled. You should be able to find the file here : %ProgramFiles%\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\

.NET 4 has it's own Assembly folder (c:\windows\Microsoft.NET\assembly) which has a \GAC_32 and \GAC_64 directories within... This is where you will find your files once they're installed.

Hope that helps...

ShaneBlake
  • 11,056
  • 2
  • 26
  • 43
  • Is gacutil available on client machines? I seem to remember that it's only available if you have the SDK installed. – 3Dave Jun 28 '11 at 14:22
  • @David : Yes. It is considered a developer tool, so you must have the SDK installed. – ShaneBlake Jun 28 '11 at 14:30
  • @ShaneBlake thought so. I've used deployment projects to get the assemblies in the correct place, though the GAC is not high on my list of favorite places. – 3Dave Jun 28 '11 at 14:32
  • 1
    @David I agree. In our web apps, I prefer to just put them in `\AppLocalResources` so they get deployed in the `\bin` and I always know which version I'm using... – ShaneBlake Jun 28 '11 at 14:40
  • Thanks to the both of you. I typically avoid dealing w/ the GAC, but SSIS requires custom components are installed in the GAC. – Jerad Rose Jun 28 '11 at 15:01
  • @ShaneBlake - I looked into this, and `C:\Windows\Microsoft.NET\assembly` has three folders: GAC_32, GAC_64, and GAC_MSIL. It looks like GAC_32 & GAC_64 have only a few assemblies. GAC_MSIL looks more reflective of the actual GAC, as it has several more (400 vs. 20 & 30), and it has the one I added. However, I'm still not sure if GAC_MSIL is considered 32bit or 64bit. – Jerad Rose Jun 28 '11 at 15:59
  • @Jerad My understanding is that GAC_MSIL contains .dll's that can run under either 32 or 64. – ShaneBlake Jun 28 '11 at 16:22
  • I believe these GAC_MSIL assemblies must be compiled for "Any CPU" so they should be able to run as both x64 and x86 – Sudhanshu Mishra Oct 08 '13 at 12:49
  • In my case, it was under `C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\x64`, and `%ProgramFiles%` went to `C:\Program Files`. – Panzercrisis Sep 26 '16 at 19:23
  • @3Dave It looks like [it might be possible to just copy/paste gacutil.exe (and its dll / config file) to a client system](http://blog.janjonas.net/2013-09-15/net4-gacutil_exe-does-nothing-copying-gacutil_exe-machine-server), I might try this for a quick test. – jrh Oct 09 '18 at 20:59
  • 1
    @jrh Well, I haven't messed with this in 7 years. BUT, yeah, gacutil doesn't have many external dependencies. Good luck! – 3Dave Oct 09 '18 at 21:02
  • 1
    @3Dave just coming back to report, yes, it definitely works to copy/paste both the x86 and x64 versions of gacutil to a testing PC. – jrh Oct 11 '18 at 01:11
0

For Windows 10:

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin

GorvGoyl
  • 42,508
  • 29
  • 229
  • 225
  • One thing that I have been wondering for a while, is there any reason to **not** use the absolute latest SDK that you have? Confusingly, I have v7.0A on Windows 10, and v10.0A on Windows 7; does the SDK version have any effect at all? Maybe backwards compatibility? Additional features? – jrh Oct 09 '18 at 21:00
  • 1
    @jrh while we're reviving zombie threads: yes, backwards compatibility is the chief reason to not use the latest SDK. If you need to deploy to Win7, using an RS5-specific SDK will not make you any friends. – 3Dave Oct 09 '18 at 21:05