Reputation: 1835
Ok, I have had a good look and found nothing useful on this problem. I have a solution in VS (Visual Studio). It has two projects say ProjectA and ProjectB.
ProjectA creates A.dll
.
ProjectB creates B.EXE
which references A.dll
.
In DEBUG mode everything works correctly as you would expect. However, in release mode the files are moved to where they will be located when installed. The A.dll
will not be installed in the GAC. Because the A.dll
is not where it is expected to be in relation to B.EXE
the exes fail. Reasonable enough.
In the After Build Event I copy the .exes to c:\los\
and A.dll
gets moved to c:\los\libs\
Currently I have to de-reference the A.dll
and then re-reference it now pointing it to it's new location, rebuild and then the release version works. The real solution has a lot of projects and a great number of .dlls which means I can easily (and do) forget to re-reference new .dlls regularly.
Is there a way to automate this tiresome process?
Upvotes: 0
Views: 79
Reputation: 2317
I believe you are looking for the probing feature of .Net. Here is the reference: https://msdn.microsoft.com/en-us/library/823z9h8w.aspx
Example:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="libs"/>
</assemblyBinding>
</runtime>
</configuration>
Probing has the limitation that only subfolders can be searched from where the executing EXE is running. However, since your EXE is in C:\Ios and the DLL is in the subfolder C:\Ios\Libs. Per the documentation you can specify multiple subfolders. I just put the "Libs" folder into the example to match your question.
Upvotes: 1