I use VS 2019, I have a .NET Standard (2.0) library project named Foo (using ServiceStack NuGet package) and a main .NET Framework (4.7.2) windows service project named Bar (also using ServiceStack NuGet). Bar has a reference to Foo. Bar is a windows service and a ServiceStack REST host, Foo has the DTOs shared across solutions (it needs ServiceStack library for the [Route] attribute).
When I try to run any ServiceStack-related code in Bar, I get:
{"Could not load file or assembly 'ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null"} System.IO.FileLoadException
Despite having this entry in Bar's app.config (I use the publicKeyToken from Bar's .csproj):
<dependentAssembly>
<assemblyIdentity name="ServiceStack.Interfaces" publicKeyToken="02c12cbda47e6587" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
How can I make those two work together?
Edit:
Both ServiceStack NuGet packages in Foo and Bar have version 5.5.0
(the .NET Framework's .dll "version" as seen in VS properties is 5.0.0.0
). I have tried with and without a publicKeyToken
, I've tried mapping oldVersion="0.0.0.0-5.5.0.0" newVersion="5.0.0.0"
and oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0"
.
The actual .dll in the output folder has this full name: ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587