Recently I was stuck with the error Try removing one of the references or sign them to enable side-by-side. This is not a common error, but I received it because I was in the very unfortunate situation of requiring to have two different versions of the same DLL installed in my solution. Let's explore how I worked around this.
Here is some background of what I was trying to accomplish. I had an existing API integration with Stripe.net. This integration was very old, as in 5 years old. The integration was working flawlessly so we never upgraded the SDK we were using.
Recently Stripe has introduced Stripe Connect where, using OAuth, the client agrees to you, the provider, to perform API and direct charge requests. The old way was to simply use the client's API keys. This is now discouraged.
Of course the version of the SDK we were using doesn't support this newer Stripe Connect functionality.
My first thought was that I could install different versions of the Stripe NuGet package by creating different projects. This allowed me to compile my code. However, when I ran it I received the dreaded run-time error regarding side-by-side references.
It was a given that we had to support both integrations while we migrate our existing clients to the new Stripe Connect approach.
Let's continue on to the solution.
Two different projects I think is still a good solution, so how to solve the duplicate references. My solution was as follows:
This allowed me to overcome the Try removing one of the references or sign them to enable side-by-side error.
In my BIN directory I now have two Stripe DLLs: Stripe.old.dll and Stripe.net.dll. This is the secret to have two different versions of the same library in your C# projects. Perhaps not the prettiest solution, but it allowed me to support both implementations without having to refactor the original implementation. Published on Apr 13, 2019 Tags: dll
| ASP.NET MVC and Web API Tutorial
| c#
Did you enjoy this article? If you did here are some more articles that I thought you will enjoy as they are very similar to the article
that you just finished reading.
No matter the programming language you're looking to learn, I've hopefully compiled an incredible set of tutorials for you to learn; whether you are beginner
or an expert, there is something for everyone to learn. Each topic I go in-depth and provide many examples throughout. I can't wait for you to dig in
and improve your skillset with any of the tutorials below.
Try removing one of the references or sign them to enable side-by-side
Related Posts
Tutorials
Learn how to code in HTML, CSS, JavaScript, Python, Ruby, PHP, Java, C#, SQL, and more.