I’m trying to add some logging to my solution, i have an internal server error that i’m trying to find.
But adding from nuget Servicestack.Logging.EventLog gives me this error:
The type ‘LogManager’ exists in both ‘ServiceStack.Interfaces, Version=126.96.36.199, Culture=neutral, PublicKeyToken=null’ and ‘ServiceStack.Interfaces, Version=188.8.131.52, Culture=neutral, PublicKeyToken=02c12cbda47e6587’
This error indicates you’re trying to reference both the Signed .NET Framework ServiceStack.Interfaces and the unsigned .NET Standard version, you can only reference the same versions of ServiceStack packages in the entire solution. This is likely caused by referencing the wrong dependencies. If you’re trying to use EventLogFactory I’m assuming you’re trying to only reference .NET Framework builds? In which case one of your dependencies is transitively referencing the .NET Standard version of ServiceStack.Interfaces which you need to resolve by removing any .Core packages or ServiceStack.Kestrel which are the only packages which contains .NET Standard only builds.
Sorry for late reply.
The template i used was the selfhost-corefx.
I’m trying to reproduce the project and see what framework the projects have from the beginning.
But there is no ServiceStack template anymore on my machine. trying to install but nothing happens.
(Windows 10 build 16299)
First npm install -g @servicestack/cli
And then just dotnet new
However, now i have no ServiceStack template anymore at all. npm uninstall -g @servicestack/cli and then a npm install -g @servicestack/cli but dosen’t help.
Sorry, my misstake. Now i did the
dotnet-new selfhost-corefx TestSelf
And then i just do a rebuild and i got the same error:
Severity Code Description Project File Line Suppression State
Error CS0433 The type ‘IServiceClient’ exists in both ‘ServiceStack.Interfaces, Version=184.108.40.206, Culture=neutral, PublicKeyToken=null’ and ‘ServiceStack.Interfaces, Version=220.127.116.11, Culture=neutral, PublicKeyToken=02c12cbda47e6587’ TestSelf.Tests D:\slask\TestSelf\TestSelf.Tests\IntegrationTest.cs 33 Active
A bit “confusing” with different frameworks. Maybe in a future there could be a filtering in the visual studio/handling nuget packages that only showing compatible.
I will have to get better attention regarding this but i will learn eventually.
I’m not sure how to better explain it, the issue is that you’re creating an ASP.NETCore App in a .NET Framework v4.7 solution, this limits you to only be able to use NuGet packages that only contain .NET Standard 2.0 builds since ASP.NET Core Apps must reference .NET Standard 2.0 builds.
The list I linked to provides the definitive reference, but essentially the rule is that only .Core packages (and ServiceStack.Kestrel) contains only .NET Standard 2.0 builds.
NuGet shows you which builds each package contains under the Dependencies section:
Which shows .NETFramework 4.5 meaning that this package can only be used for classic ASP.NET or HttpListener Self Hosting Web Apps (i.e. not ASP.NET Core). Since you’re using .NET Framework v4.7 it will always try to reference .NET Framework builds over .NET Standard 2.0 which is not what you want.