Evgeny Pokhilko's Weblog

Programmer's den

How to load referenced assemblies from any place you want


This is HowTo for those who need it. The app.config file below defines rules for the main assembly. It sets where the referenced assemblies could be found at runtime. The main assembly references other two assemblies and gets one of them from network (\\someserver\shared\Summator.dll) and another one from the local machine in a subdirectory.

Application config file is below:

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity
            name="Summator"
            publicKeyToken="03840bb05afb3f17"
            culture="neutral" />
        <codeBase
            version="1.0.0.0"
            href="file:///\\someserver\shared\Summator.dll"/>
      </dependentAssembly>
      <probing privatePath="SUB1\SUB2\SUB3\">
      </probing>
    </assemblyBinding>
  </runtime>
</configuration>


If you reference an assembly from your local machine, you are not limited by subdirectories of the main application because you can use the following method to mount your drives to one of the subdirectories:

http://support.microsoft.com/kb/307889

PS: Configuration files can be conveniently edited by the mscorcfg.msc tool (Control Panel – Administrative Tools – Microsoft .NET Framework 2.0 Configuration, MyComputer, Application, Right click, Add…).

June 25, 2008 - Posted by | .NET |

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: