6

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.

Saar
  • 8,286
  • 5
  • 30
  • 32
theraneman
  • 1,620
  • 4
  • 18
  • 32

2 Answers2

8

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
  • 67,283
  • 14
  • 105
  • 142
  • 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 Dec 14 '09 at 16:19
1

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
  • 1,620
  • 4
  • 18
  • 32
  • 1
    You should have marked an answer (and add a comment to it if you want) instead of creating another answer here... – Ivan Danilov Dec 18 '15 at 15:55