I've got a web application and a corresponding web.config. The application depends upon assemblies, which are located on the system in a specific path (e.g. c:\programms\myprog\bla.dll) but not registered in the GAC. How can I tell my web application where to find these assemblies it depends upon? I guess I can do that somewhere in the web.config. But how?
Thanks in advance!
Static assemblies are stored on disk in portable executable (PE) files. Static assemblies can include interfaces, classes, and resources like bitmaps, JPEG files, and other resource files. You can also create dynamic assemblies, which are run directly from memory and aren't saved to disk before execution.
The path attribute defines the site or virtual directory that the configuration settings cover. To specify that the settings in the <location> element apply to the default Web site, set the path attribute to Default Web Site .
For strong-named assemblies, the binding process continues by looking in the global assembly cache. The global assembly cache stores assemblies that can be used by several applications on a computer. All assemblies in the global assembly cache must have strong names.
Check this article on Assembly Binding Redirection.
Basically you should add this to your config file:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v1.0.3705">
<dependentAssembly>
* assembly information goes here *
</dependentAssembly>
</assemblyBinding>
</runtime>
You should be using the codebase element as given in http://msdn.microsoft.com/en-us/library/efs781xb(VS.71).aspx, even though article says href, it can be used for local paths also
Why do you store assemblies in 1 specific location? For debugging purposes? You can also add a hintpath for debugging purposes. Add a file ref to it an make it copy local = true. Assembly lookup will first be local in the debug\bin folder (application base).
Wherever possible, always store your assemblies in the GAC. It'll behave like the single directory you're using now, with the added advantage of side-by-side deployment!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With