You can specify an alternate directory source for assemblies outside of the application directory structure by specifying a <codebase> setting within a publisher policy file. This requires you to strongly name your assemblies and you must specify the specific assembly version that the codebase binding applies to. The following application configuration shows how to locate version 184.108.40.206 of the ServerLib assembly in the c:\SharedDependencies directory:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="ServerLib" publicKeyToken="ada0a9d1dd805043" culture="neutral" /> <codeBase version="220.127.116.11" href="c:\SharedDependencies\ServerLib.dll"/> </dependentAssembly> </assemblyBinding> </runtime> </configuration>If you are trying to share assemblies between multiple applications, you should consider using the Global Assembly Cache (GAC), which removes the need for specifying a publisher policy to override how the runtime locates assemblies. The runtime always looks to the GAC first for an assembly. This also requires that assemblies are strongly named, but in general using strong names is recommended so that you can leverage version control and security features of the .NET runtime.
For sample code and a brief article related to this subject, see the following link:
Dig Deeper on Microservices pattern, platforms and frameworks
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.