0

Running in VS2019 Admin Cmd window -- gacutil.exe error: "Failure adding assembly to the cache. The system cannot find the file specified." GAC util path: C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\gacutil.exe Command line: gacutil.exe -i "DuraSysOrdFuncs.dll" -r FILEPATH "C:\Windows\DuraSysOrdFuncs.dll" "" I picked this version of GACUtil just because the C# library was built with a target framework of .Net 4.7. It isn't clear to me that it much matters. Doesn't matter what I put in the 3rd parameter of -r. Doesn't matter where I put my assembly on my local disk. Same error message. I'm trying to put this in GAC because I need to call it from an SSIS package running on SQL Server 2016. I have opened Sysinternals ProcMon per a suggestion of @HansPassant in a different post. Not familiar with tool so haven't found the file location error. . . if that is the actual issue.

Any input much appreciated

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Jim
  • 1
  • 2
  • 1
    Did you try passing a full path to the /i parameter? – Klaus Gütter Oct 06 '22 at 04:37
  • That error would indicate to me that the specification of the DLL is wrong; that `gacutil` can't find `DuraSysOrdFuncs.dll` – Flydog57 Oct 06 '22 at 04:46
  • Yes. You are both correct. I opened ProcMon after posting this and found an even indicating the DLL needing registration was being searched for in the path of the version of gacutil.exe that I was using. I checked the GACUTIL help notes. Moving to fast and missed the part about the path. . . should have triple checked rather than posting. But thanks! I'm glad others have posted. Very helpful resource, is StackOverflow. – Jim Oct 12 '22 at 14:34

2 Answers2

0

The answer, as the commenters noted, and as ProcMon indicates, is to just include the path for the .net assembly you're registering: gacutil.exe -i "C:\YourAssemblyFileLocation\YourDLL.Dll" That's all it takes. . .you don't normally need -r parameters, etc. Thanks!

Jim
  • 1
  • 2
0

You can use powershell to register assemblies into GAC. It doesn't need any specific installation.

Set-location "C:\Temp" [System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") $publish = New-Object System.EnterpriseServices.Internal.Publish $publish.GacInstall("C:\Temp\myGacLibrary.dll")

If you need to get the name and PublicKeyToken, refer How do I find the PublicKeyToken for a particular dll?

ritikaadit2
  • 171
  • 1
  • 10