I had an application buit with DNX that was working fine. I tried to make it works with CLI but I got an error on the startup. The error is :
L'exception System.TypeInitializationException n'a pas été gérée
HResult=-2146233036
Message=Une exception a été levée par l'initialiseur de type pour 'System.Diagnostics.DiagnosticSourceEventSource'.
Source=System.Diagnostics.DiagnosticSource
TypeName=System.Diagnostics.DiagnosticSourceEventSource
StackTrace:
à System.Diagnostics.DiagnosticListener..ctor(String name)
à Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildHostingServices()
à Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
à DSF.Infra.OutilPilotage.Program.Main(String[] args) dans C:\PROJETS\OutilPilotage\Features\SPRINT2-AUDIENCEURI\Web\DSF.Infra.OutilPilotage\DSF.Infra.OutilPilotage\Program.cs:ligne 25
InnerException: System.MissingMethodException
HResult=-2146233069
Message=Méthode introuvable : 'Void System.Diagnostics.Tracing.EventSource..ctor(System.Diagnostics.Tracing.EventSourceSettings)'.
Source=System.Diagnostics.DiagnosticSource
StackTrace:
à System.Diagnostics.DiagnosticSourceEventSource..ctor()
à System.Diagnostics.DiagnosticSourceEventSource..cctor()
InnerException:
There is the extract of my "project.json" showing the Self-contained settings.
"frameworks": {
"net461": {
"frameworkAssemblies": {
"System.Web": "4.0.0.0"
},
"dependencies": {
}
}
},
"runtimes": {
"win7-x64": {}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
I did a monitoring and I see that the self-contained application load library from my local .NET. Since I target .NET 4.6.1 and I don'T have it installed it crashed. I need self-contained application to don't have to install it on workstation. What is the correct setting to make it works?