Zaha
Zaha

Reputation: 946

Error in Net Framework App Using 4.6.1 with "System.Diagnostics.DiagnosticsSource" File Not Load

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:

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

Answers (2)

c-romeo
c-romeo

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

Zaha
Zaha

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

Related Questions