.Net CodeBase

I have looked at several other posts on how to get the CLR to find an assembly that is not in the same folder or any subfolder of the executable and I cannot get it to work for me. ClassLibrary1.dll is an unsigned assembly. Examples show:

<configuration> 
<runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
        <dependentAssembly> 
            <assemblyIdentity name="ClassLibrary1"/> 
            <codeBase version="1.0.0.0"                    
                href=file:///C:\somepath\subfolder\ClassLibrary1.dll"/> 
        </dependentAssembly> 
    </assemblyBinding> 
</runtime> 
</configuration> 

      

I created a console app and put the above with the correct path in my config file, but I still get a message that it cannot find ClassLibrary1.dll. I used FUSLOGVW and it didn't even check the folder specified in the CodeBase element. Does anyone know why this is not working?

+3


source to share


1 answer


From MSDN :

If the assembly has a strong name, the codebase setting can be anywhere on the local intranet or on the Internet. If the assembly is private assembler, then the codebase parameter must be the path to the application directory .



This means that if you do not sign your assembly, it must be in the application folder or a subfolder of the application folder. If you want to put your application in c: \ Program Files \ MyApplication and your assembly in c: \ MyAssemblies, you must sign the assembly.

+2


source







All Articles