Search code examples
c#wpfxamldllgac

Why have to add to GAC. DLL already given in exe folder


I wrote an shell extension in c#. App shows WPF Dialogs and I use Xaml.Behaviors When I run the App. All other DLL are found. (Same Folder as exe) But App throw an exception for missing Microsoft.Xaml.Behaviors.dll (but is actually there in same folder)

so I run: gacutil.exe /i ...\bin\Debug\Microsoft.Xaml.Behaviors.dll This fix my issue.

My quesion is why other dlls are found and not xmal_behaviors?

Is it possible to skip the GAC step?

Update:

  • Yes. Behaviors are referenced by nuget package.
  • Main process is explorer.exe

Solution

  • Try adding a reference to the DLL in your project and set the "Copy Local" property to true. This will cause the DLL to be copied to the output directory of your application when it is built, and loaded from that location at runtime.