dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.38k stars 10k forks source link

Blazor server side: Conflicting assets with the same path '/wwwroot/_framework/_bin/System.Console.dll' for content root paths #29118

Closed SeppPenner closed 3 years ago

SeppPenner commented 3 years ago

Describe the bug

I recently tried to switch my Blazor server side (with a custom Blazor library) project from netcoreapp3.1 to net5.0. However, after changing the framework versions, I now fell over the issues that somehow System.Console.dll seems to be overwritten from the server file (If I understood https://github.com/dotnet/aspnetcore/issues/26928 correctly). Is there anything else I could check to see where exactly the issue is? Right now, I have no idea which packages or projects cause the issue. This only occurs while publishing, e.g. with dotnet publish --configuration Release -r win10-x64 --output publish/...

To Reproduce

Difficult to say, I wasn't able to reproduce this in a minimum working example yet.

Exceptions (if any)

C:\Program Files\dotnet\sdk\5.0.101\Sdks\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(208,5): error :
Conflicting assets with the same path '/wwwroot/_framework/_bin/System.Console.dll' for content root paths
'C:\Users\Nutzer\Documents\Temp\src\Example.Clients\obj\Release\net5.0\win10-x64\blazor\unlinked\System.Console.dll' and
'C:\Users\Nutzer\.nuget\packages\microsoft.netcore.app.runtime.win-x64\5.0.1\runtimes\win-x64\lib\net5.0\System.Console.dll'.
[C:\Users\Nutzer\Documents\Temp\src\Example.Server\Example.Server.csproj]

Further technical details

.NET SDK (gemäß "global.json"):
 Version:   5.0.101
 Commit:    d05174dc5a

Laufzeitumgebung:
 OS Name:     Windows
 OS Version:  10.0.19041
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.101\

Host (useful for support):
  Version: 5.0.1
  Commit:  b02e13abab

.NET SDKs installed:
  2.1.806 [C:\Program Files\dotnet\sdk]
  3.1.201 [C:\Program Files\dotnet\sdk]
  3.1.202 [C:\Program Files\dotnet\sdk]
  3.1.300 [C:\Program Files\dotnet\sdk]
  3.1.402 [C:\Program Files\dotnet\sdk]
  5.0.100 [C:\Program Files\dotnet\sdk]
  5.0.101 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
SeppPenner commented 3 years ago

Ok, I found the issue, but still I don't understand it. My project file has specified the following:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net5.0-windows</TargetFramework>
    <RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
    <LangVersion>latest</LangVersion>
  </PropertyGroup>

// And so on ...

If I run dotnet publish --configuration Release -r win10-x64 --output publish/, the above error occurs. If I run dotnet publish --configuration Release --output publish/, leaving the runtime out, it works as expected.

mkArtakMSFT commented 3 years ago

Thanks for contacting us. It looks like you didn't complete migration properly. We recommend following our migration guide and asking questions in StackOverflow if you face issues with it.

SeppPenner commented 3 years ago

Thanks for the information, I thought, I did everything in there...

In case anybody gets the same issue, I have:

So, probably the issue in my case was the wrong SDK and the reference to Microsoft.AspNetCore.Components.WebAssembly.Build.