Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, March 14, 2017 1:39 AM
If I have 2 dlls with same name, public key token and culture.
How can I reference them both in the same C# project?
Scenarios: having to reference and old and new dll for the sake of upgrade.
Regards
Min Chew
[Edit]
Solution here
- In app.config
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="myAssembly"
publicKeyToken="here token dll"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0" />
<bindingRedirect oldVersion="1.0.0.1-2.0.0.0" newVersion="2.0.0.0" />
<codeBase version="1.0.0.0" href="folder\namedll.dll" />
<codeBase version="2.0.0.0" href="folder\namedll.dll" />
</dependentAssembly>
</assemblyBinding>
- Unload and edit the csproj file, and add or set:
<AutoGenerateBindingRedirect>false</<AutoGenerateBindingRedirect>
All replies (3)
Thursday, March 16, 2017 3:17 AM ✅Answered | 1 vote
Hi Min Chew,
I have found this issue has been resolved in stackoverflow, I post this link here, and you could mark this reply, which could help others to find the solution.
http://stackoverflow.com/questions/42715564/using-2-different-versions-of-the-same-dll
Sincerely,
Oscsar
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected].
Tuesday, March 14, 2017 2:19 AM
Using BindingRedirect can be tricky at best, you might consider asking here
Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
VB Forums - moderator
Tuesday, March 14, 2017 2:30 AM
This issue appears to a mix of C# (extern alias) and MSBuild as well as the csproj file, so probably is best in the Visual Studio General section.
[Edit] Thanks for moving to the appropriate forum