I have very simple C# library (we'll call it myApi.dll) targeted for .NET 2.0 that executes a simple database insertion. I underlying requirements must keep it at .NET 2.0. When I reference myApi.dll in a new a new VS2013 app, also targeting .NET 2.0, it works exactly as programmed.
The problem is when I take myApi.dll over to another project targeted for .NET 4.5, developed in VS2019, it crashes. It's crashing with an error message that says.
"Could not load file or assembly 'Microsoft.Vsa, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified."
Both executing programs are on the same machine. The app targeting .NET 2.0 runs myApi.dll fine but the app targeting .NET 4.5 doesn't.
I've reviewed helpful hints like
- can i call a .net 2.0 dll in .net 3.5?
- use .Net 2.0 dll in .net 4.0 wpf application
- use .net 2.0 dll in .net 4.5 project (vshost crashes on debug)
I thought setting my 4.5 applications App.confg file to mirror this would help but it didn't.
<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
<supportedRuntime version="v2.0"/>
</startup>
</configuration>
Any thoughts as to why the .NET 2.0 can call myApi.dll just fine and the .NET 4.5 app crashes?