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 issueSteps 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:
- Created 6 years ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
The issue was solved using the latest .NET Core 2.0 release (final - https://download.microsoft.com/download/0/F/D/0FD852A4-7EA1-4E2A-983A-0484AC19B92C/dotnet-sdk-2.0.0-osx-x64.pkg).
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 👍