Can you use environment variables to replace hardcoded path for href attribute in codebase element

542 Views Asked by At

I was curious if CLR could load assemblies from a specific location and this is what I found which basically loads the assembly from C:\MyAssemblies folder.

Now, my question is - Is it possible to use environment variables in the following href attribute? In other words, instead of c:\ is it possible to say something like %windir% ?

I am probably going to use GAC for what I need to get done but I was wondering if using environment variables in this context was even possible. Thanks.

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentAssembly>
            <assemblyIdentity name="MyAssembly2"  culture="neutral" publicKeyToken="307041694a995978"/>
            <codeBase version="1.0.1524.23149" href="FILE://C:/Myassemblies/MyAssembly2.dll"/>
         </dependentAssembly>
      </assemblyBinding>
   </runtime>
</configuration>
1

There are 1 best solutions below

0
On

Sadly this doesn't seem to be possible, at least not using the standard Microsoft syntax for environment variables of %FOO%.