This is very related to this question, but for .net Core. I have a custom layout renderer that adds UserId and it worked until I tried to upgrade from "net461" in project.json to "netcoreapp1.0". When I did that, I had to remove NLog.Extensions because it gave me this error:
Package NLog.Extensions 1.0.1 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package NLog.Extensions 1.0.1 supports: net45 (.NETFramework,Version=v4.5)
Everything compiles fine, but at runtime, I get this error in the internal-nlog.txt log file, and of course, it doesn't hit my custom layout renderer.:
NLog.NLogConfigurationException: Error when setting property 'Layout' on NLog.Targets.DatabaseParameterInfo ---> System.ArgumentException: LayoutRenderer cannot be found: 'aspnet-user-id'
Is there a replacement for NLog.Extensions, or am I missing something?
Here are the references from project.json:
"NLog.Extensions.Logging": "1.0.0-rtm-alpha4",
"NLog.Web.AspNetCore": "4.2.4" },
I have everything configured in Startup.cs and NLog.config exactly the same as it was before changing framework versions. If it's helpful to post those, let me know and I'll do that. I appreciate the help.
Edit: Added project.json contents
"dependencies":{
"Microsoft.NETCore.App":{
"version":"1.0.1",
"type":"platform"
},
"Microsoft.AspNetCore.Authentication.Cookies":"1.0.0-*",
"Microsoft.AspNetCore.Diagnostics":"1.0.0-*",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore":"1.0.0-*",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore":"1.0.0-*",
"Microsoft.AspNetCore.Mvc":"1.0.0-*",
"Microsoft.AspNetCore.Server.IISIntegration":"1.0.0-*",
"Microsoft.AspNetCore.Server.Kestrel":"1.1.0-preview1-final",
"Microsoft.AspNetCore.StaticFiles":"1.0.0-*",
"Microsoft.EntityFrameworkCore.SqlServer":"1.1.0-preview1-final",
"Microsoft.EntityFrameworkCore.Tools":"1.0.0-*",
"Microsoft.Extensions.Configuration":"1.1.0-preview1-final",
"Microsoft.Extensions.Configuration.EnvironmentVariables":"1.1.0-preview1-final",
"Microsoft.Extensions.Options.ConfigurationExtensions":"1.0.0-*",
"Microsoft.Extensions.Configuration.Json":"1.0.0-*",
"Microsoft.Extensions.Configuration.UserSecrets":"1.0.0-*",
"Microsoft.Extensions.Logging":"1.1.0-preview1-final",
"Microsoft.Extensions.Logging.Console":"1.0.0-*",
"Microsoft.Extensions.Logging.Debug":"1.0.0-*",
"Microsoft.VisualStudio.Web.BrowserLink.Loader":"14.0.0-rc2-final",
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc":{
"version":"1.0.0-*",
"type":"build"
},
"RestSharp.NetCore":"105.2.3",
"Dapper":"1.50.2",
"NLog.Extensions.Logging":"1.0.0-rtm-alpha4",
"NLog.Web.AspNetCore":"4.2.4"
},
"tools":{
"Microsoft.AspNetCore.Razor.Tools":{
"version":"1.0.0-*",
"imports":"portable-net45+win8+dnxcore50"
},
"Microsoft.AspNetCore.Server.IISIntegration.Tools":{
"version":"1.0.0-*",
"imports":"portable-net45+win8+dnxcore50"
},
"Microsoft.EntityFrameworkCore.Tools":{
"version":"1.0.0-*",
"imports":[
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
},
"Microsoft.Extensions.SecretManager.Tools":{
"version":"1.0.0-*",
"imports":"portable-net45+win8+dnxcore50"
}
},
"frameworks":{
"netcoreapp1.0":{
"imports":[
"dotnet5.6",
"portable-net45+win8"
]
}
}