I have a dll that can't be put in the same directory of the exe that calls it. How can I configure visual studio to find it?
My msi installer project includes two different versions of a dll with the exact same name, targeting the usual root install folder. So when the installer runs on the client machine, only one of them gets installed.
I guess I have to tell the installer project to put the older dll in a different folder. Th开发者_如何学Pythone problem is, how do I tell the program to look in that specific folder for that specific dll? I'm using C# and VS2010.
Thanks,
Isaac
Suffix the assemblies according to their version numbers and deploy them to the same directory that way. Otherwise, it will get really messy with updates.
If you really want, you can use this sort of an app.config file to relocate the assembly: http://support.microsoft.com/kb/837908
<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>
Well, I just ended up manually loading the assemblies. As in using Assembly.LoadFrom(relative path string)
I tried suffixing them but it started complaining it didn't match the app.manifest file.
The assembly resolve event also didn't work, because the reportviewer control didn't fire assemblyresolve for all of the dlls. Maybe because it's in it's own appdomain.
Anyway, this seems to work for now.
-Isaac
精彩评论