2

I am unable to add an assembly into GAC. Please assist in getting it work. I ran following command in VisualStudio13 CMD

gacutil /i “<C:\Program Files\ibm\IBM DATA SERVER DRIVER>\bin\netf40_32\IBM.Data.DB2.Entity.dll”

Error Message: Command "gacutil" is not valid.

Also, i checked there is also no gacutil.exe file on path

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

C:\Program Files (x86)>dir gacutil.exe /s Command gives me following description

But when i access the path there is no gacutil file as shown: Folder view No gacutil present

BASEER ULHASSAN
  • 461
  • 4
  • 22
  • It's weird that it's missing. You could try installing the SDK as [this answer](http://stackoverflow.com/a/7968775/119477) suggests – Conrad Frix Aug 19 '16 at 19:35
  • I installed Windows SDK @Path = C:\Program Files (x86)\Windows Kits\8.0 There is still no GACUTIL.exe in it. It must be included in VS13 as well. I went through your suggested answer link earlier but no good :( – BASEER ULHASSAN Aug 19 '16 at 19:44
  • I know it sounds obvious but did you try doing something like `C:\Program Files (x86)>dir gacutil.exe /s` I found no less than 12 versions of it – Conrad Frix Aug 19 '16 at 19:47
  • It finds gacutil.exe in C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools AND C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\x64. But no such files visible. Also, there are visible gacutil named files in SDK path like C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin however in .\NETFX 4.0 Tools\x64 path i cant find one. – BASEER ULHASSAN Aug 19 '16 at 19:57
  • I'm confused. You say that dir finds it but then you say no such files are visible. Can you explain what you mean by not visible? – Conrad Frix Aug 19 '16 at 20:00
  • Hope, I am able to make things a lil clear with Post edited. – BASEER ULHASSAN Aug 19 '16 at 20:08
  • Don't trust windows explorer. Trust command. Try adding one of the gacutil locations to your path or use the whole path and it should work. e.g. `" C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\gacutil.exe" /i "C:\Program Files\ibm\IBM DATA SERVER DRIVER>\bin\netf40_32\IBM.Data.DB2.Entity.dll"` – Conrad Frix Aug 19 '16 at 20:29
  • Nailed it. Using cmd Full path names are working !!!! :) :) Thanks a bunch Sir Frix (y) – BASEER ULHASSAN Aug 19 '16 at 21:03

2 Answers2

4

The issue was Windows Explorer path(C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\gacutil.exe) had no "gacutil.exe". Accessing the same path through cmd listed down "gacutil.exe" as present.

Thus, instead of just giving command gacutil-i to add an assembly in cache, i gave full path

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0Tools\gacutil.exe -i

Don't trust windows explorer. Trust command credits@ Sir Conrad Frix-Comments

BASEER ULHASSAN
  • 461
  • 4
  • 22
  • That is not the issue, you are not supposed to have a "NETFX 4.0 Tools" subdirectory at all. Not in SDK v7.0a, that directory only got added in later SDK versions. How sn.exe ended up there is very hard to guess, it doesn't belong there at all, something went wrong on your machine a while ago. Just in case, *never* fix a build problem by copying files. You are supposed to use the 8.1A version of gacutil, the SDK version married to VS2013. Looks like you simply forgot to use the Visual Studio Command Prompt (aka vcvarsall.bat). – Hans Passant Aug 19 '16 at 21:56
  • Passant@ Thanks for looking into the problem. The VS13 Command Prompt was giving : >gacutil -i Command "gacutil" is not valid. – BASEER ULHASSAN Aug 20 '16 at 09:42
0

You can either drag-drop the .dll into c:\windows\assembly folder or check C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\x64 for gacutil as its part of .net framework, not your IDE. Hope it helps!