question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting ASP.NET Core 2.0 Final error with .NET Core 2.0: Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource

See original GitHub issue

Steps to reproduce

Create a ASP.NET Core 2.0 (final) project or any project with: <ItemGroup> <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" /> </ItemGroup>

dotnet restore dotnet run

Expected behavior

Run without errors or warnings

Actual behavior

Dotnet run results in the error below:

dotnet run: /usr/local/share/dotnet/sdk/2.0.0-preview2-006497/Microsoft.Common.CurrentVersion.targets(1984,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed. [/Users/guilherme/Desktop/CatalogWeb/CatalogWeb.csproj]

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly ‘System.Diagnostics.DiagnosticSource, Version=4.0.2.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors) at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() at CatalogWeb.Program.BuildWebHost(String[] args) in /Users/guilherme/Desktop/CatalogWeb/Program.cs:line 21 at CatalogWeb.Program.Main(String[] args) in /Users/guilherme/Desktop/CatalogWeb/Program.cs:line 17

Environment data

dotnet --info output: .NET Command Line Tools (2.0.0-preview2-006497)

Product Information: Version: 2.0.0-preview2-006497 Commit SHA-1 hash: 06a2093335

Runtime Environment: OS Name: Mac OS X OS Version: 10.13 OS Platform: Darwin RID: osx.10.12-x64 Base Path: /usr/local/share/dotnet/sdk/2.0.0-preview2-006497/

Microsoft .NET Core Shared Framework Host

Version : 2.0.0-preview2-25407-01 Build : 40c565230930ead58a50719c0ec799df77bddee9

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
guidefreitascommented, Aug 14, 2017
1reaction
d-saravanancommented, Aug 25, 2017

Updating to Visual Studio 2017, 15.4, Preview 1 and installing the dotnet core 2.0 final release enabled me to get rid of this error and i am able to run the app now. Thanks 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not load file or assembly 'System.Diagnostics. ...
I was getting this error when trying to reference a .Net 4.6.2 lib in a .Net Core 2 project. To resolve the issue...
Read more >
System.IO.FileNotFoundException: 'Could not load file or ...
I have an application in .net core. the application was running fine, but the error started coming after I installed.
Read more >
Could not load file or assembly 'System.Diagnostics ...
The following error may occur when upgrading Microsoft ApplicationInsights: [FileNotFoundException: Could not load file or assembly 'System.
Read more >
NET core(.NET6) System.IO.FileLoadException : Could not ...
NET 6 TestAPP and worked well. currently i am running tests using Automation project(C++ project) and it was using .NET Framework 3.5 TestAPP....
Read more >
Troubleshooting installation errors
Follow the instructions to correct the error. Could not load file or assembly 'System.Diagnostics.DiagnosticSource'.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found