I have a solution with 3 projects. One is a library, the other two are console apps which both use this library.
I was having problems running one of the applications - a call into my lib that calls System.Buffers.Binary.BinaryPrimitives
was generating an assembly exception.
I noticed their app.config files are different:
App A
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
App B
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
</configuration>
All those additional assemblies are dependencies of my library project, so should presumably be in both. Why the library project itself isn't referenced I don't know.
I have never touched the config files so they are autogenerated but not equivalently. Why? And how can I get VS to regenerate?
The only difference in approach I can think of is that when I started using my library in App A, VS suggested adding a reference which I accepted. In App B, I believe I added the dependency manually.