I have a v4.0 assembly that is both in the GAC (4.0 location) for runtime use and in a location on disk for designtime use. I have the designtime DLL's location set in the registry so that I can add it via Add Reference in Visual Studio.
I also have a service that is using this DLL. I added it via Add Reference and can compile without issue while referencing its classes. However, when I run my service, it doesn't pull the DLL from the GAC, and I get an error that the service can't find a class in the GACked DLL. I can change "copy local" to true and it will work just fine, but that defeats the purpose of having the DLL in the GAC.
Any suggestions on how to troubleshoot?
I can add as reference to a new console app and access the object. Not sure what the issue is with the service.
It may not be finding the type.. but I can reference the type from the console app (using the GACked assembly), so I'm not sure why it can't find it when running the service.
You will need to add the assembly under the system.web tag in the machine.config
<system.web>
<compilation>
<assemblies>
<add assembly="YOUR_DLL_NAME, Version=1.1.0.0, Culture=neutral, PublicKeyToken=YOUR_KEY_TOKEN" />
</assemblies>
</compilation>
</system.web>
Depending on your setup, the configuration file can be found: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config or C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config