Jorge Zuverza
Jorge Zuverza

Reputation: 915

Unable to load embedded dependencies from the GAC

I made an HttpModule that I'm adding to the GAC and then registering it in my web.config. I used Fody Costura to embed dependencies. The output in my bin folder consists of only one dll, one .config and one .pdb (Because all the dependencies are merged into that file.) My problem is that whenever I load the module from the GAC, it is unable to find the embeded dependencies. I have the following observations:

<modules>
  <add name="MyModule" type="MyNamespace.MyModule.Module, MyNamespace.MyModule"/>
</modules>

My module is loaded as follows:

<modules>
  <add name="MyModule" type="MyNamespace.MyModule.Module, MyNamespace.MyModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7d22d90bda7ffgab, processorArchitecture=MSIL"/>
</modules>

I'm thinking that my module does not know that the dependencies are within itself. Is there any way I can tell my module to load the dependencies from the merged dll? Or anyone that can point me in the right direction? I'm a little bit lost here. Thanks!

Upvotes: 2

Views: 235

Answers (1)

Vlad DX
Vlad DX

Reputation: 4730

It seems that problem is related to Newtonsoft.Json itself.

These issues say that there is a problem with the same strong name of different Newtonsoft.Json versions:

So, if there is one version is already installed in GAC and you try to install another one, it won't be installed.

Assemblies that have the same strong name should be identical.

Strong-Named Assemblies | MSDN

As the result, your application couldn't find required version of Newtonsoft.Json in GAC because it's not there.

If you could try to avoid using GAC, it should solve the problem.

Upvotes: 2

Related Questions