Reputation: 946
Window Service (NetFramework) Application is Referencing NetStandard and NetFramework Projects, after It updated to netstardard 2.0 and set net framework 4.6.1 I have a problem with System.Diagnostics.DiagnosticsSource dll (4.0.2.1)
Some steps I've followed:
1.- I've updated server host with the last runtime (2.0.4), and in my development environment with the sdk 2.1.3 (https://www.microsoft.com/net/download/windows).
NOTE:
Development environment works (Debug), (Window 7 Visual Studio 2017)
Production environment doesn't works (Release), (Window Server 2012 R2)
2.- I've configured netstandard 2.0 with 4.6.1 net framework how say here (https://learn.microsoft.com/en-us/dotnet/standard/net-standard), so All Net Framework Projects with 4.6.1 and all net starndard projects with 2.0.
3.- Setting my window service project file .cproj with:
<PropertyGroup>
...
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
...
</PropertyGroup>
And
<PropertyGroup>
...
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
Doesn't work, REF: https://github.com/aspnet/EntityFrameworkCore/issues/7889
4.- All the nuget package are consolidated and updated to last version.
Some people fix the problem deleting global.json but the windows server projects doesn't use that file.
Thansk all
Upvotes: 0
Views: 2083
Reputation: 408
install package System.Diagnostics.DiagnosticSource
Install-Package System.Diagnostics.DiagnosticSource -Version 4.5.1
and after add binding redirect
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.1" newVersion="4.0.3.1" />
</dependentAssembly>
Upvotes: 0
Reputation: 946
I've resolve the problem, but I can't give you the answer about how I did it, because It was resolved changing to Debug configuration, rebuild and go to the Release and rebuild or maybe was the command:
nuget locals all -clear
EDIT: Another possibility would be the automatic update, because when this did works the host did have to restart.
Thanks all
Upvotes: 2