efcore: Could not load System.Diagnostics.DiagnosticSource
Could not load file or assembly ‘System.Diagnostics.DiagnosticSource, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’.
I am seeing a ton of people hitting this when using netcoreapp1.1
. (See #7869, #7557, #7742, #7358 & #5627) We thought dotnet/corefx#15031 was going to fix it, but there must be another underlying issue somewhere.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 32 (11 by maintainers)
Commits related to this issue
- CLI Tools: Use project's runtime framework version Fixes aspnet/EntityFramework#7889 — committed to aspnet/EntityFramework.Tools by bricelam 7 years ago
- CLI Tools: Use project's runtime framework version Fixes aspnet/EntityFramework#7889 — committed to aspnet/EntityFramework.Tools by bricelam 7 years ago
Looks like this only occurs on Class Library projects targeting
netcoreapp1.1
. The issue is that we fallback to usingef.runtimeconfig.json
which targetsMicrosoft.NETCore.App
version 1.0.0.Workaround
You can workaround the issue by forcing a runtime config to be generated by the project. This avoids falling back to running on 1.0. To do this, add the following to the project’s
*.csproj
Note, a fix has been checked into
dev
and should be available soon on the nightly build feed.