When an Assembly is strongly named, that is signed using a public-private key; then it can reside in the GAC and be referenced by multiple Assemblies.
Configuration files can be leveraged to help assemblies find their references. There are three options for this:
- Application configuration files
- Publisher policy files
- machine configuration files
Let's investigate application configuration files, let's open up our app.config file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath ="myAssemblies" />
</assemblyBinding>
</runtime>
</configuration>
Now we can specify in the app config that we want to use a newer version of our class library
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="myAssembly"
publicKeyToken="31ab3ca45f0a73f1" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>