views:

332

answers:

2

Hi guys,

I intend to keep few dll's in a folder other than the bin folder for my .NET 3.5 Windows application. I am unsure of how would I use the codebase element or the probing element to specify the right path. This is what I have in the app.config file now,

<runtime>
 <assemblyBinding>
  <dependentAssembly>
    <assemblyIdentity name="CommonLib" publicKeyToken="f0b5026b59d5645e"   
     culture="neutral" />
    <codeBase version="1.0.0.0" href="SharedFolder\CommonLib.dll" />
  </dependentAssembly>
 </assemblyBinding>
</runtime>

I get, Could not load assembly error at runtime. It seems I am doing something wrong in the config file. The SharedFolder is a folder added to the project.

A: 

It seems the codeBase element is for getting files with a URL, have you tried using the probing element?

<runtime>
 <assemblyBinding>
  <dependentAssembly>
    <assemblyIdentity name="CommonLib" publicKeyToken="f0b5026b59d5645e"   
     culture="neutral" />
  </dependentAssembly>
  <probing privatePath="SharedFolder"/>
 </assemblyBinding>
</runtime>
Yuriy Faktorovich
I thought so. Could you quickly edit the runtime element I have added to use the probing element in it? I tried that but probably I did not use it correctly.
theraneman
A: 

Thanks Yuriy. The problem was the path. the privatePath value needs to be a path which the .NET runtime can reach. I was trying to "SharedFolder" which was not inside the Debug folder, it was directly under the project folder.

theraneman