I am experiencing an error with dotnet publish. I understand the problem - two projects are copying files to the same place in the output. What I don't understand is the fix. I have a dotnet 8 Blazor web app consisting of several projects (hierarchy shows dependency chain) -
- Web (
<Project Sdk="Microsoft.NET.Sdk.Web">) <--- the artifact being published- Web.Client (
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">) <-- one of the offenders- Web.Admin.Client (
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">) <-- one of the offenders - Web.Admin.Shared (
<Project Sdk="Microsoft.NET.Sdk.Razor">) - Web.ABC.Client (
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">) (there are several of these) - ApplicationClassLib (
<Project Sdk="Microsoft.NET.Sdk">).
- Web.Admin.Client (
- Web.Client (
- Web.Admin (
<Project Sdk="Microsoft.NET.Sdk.Web">) (Deployment Artifact) - Web.ABC (
<Project Sdk="Microsoft.NET.Sdk.Web">) (Another Deployment Artifact)
I have added ErrorOnDuplicatePublishOutputFiles to Web.Client and I have added the following properties to Web.Admin.Client. I encountered this error before and adding StaticWebAssetBasePath to each of the Web.*.Client apps fixed it then. I have deleted obj and bin folders from every project and restarted Visual Studio as well. I even updated dotnet and the whole tool chain (including Visual Studio) just in case. I need the dependencies to be available at runtime - I'm not sure if removing the file from the output is the correct direction.
<PropertyGroup><StaticWebAssetBasePath>Web.Admin.Client</StaticWebAssetBasePath><ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles></PropertyGroup>The publish command - note that Visual Studio's publish fails with the same (or very similar) error.
dotnet publish 'solution\Web\Web.csproj' --no-restore --runtime:win-x64 --output:publish/Web --configuration:Local$ dotnet --info.NET SDK: Version: 8.0.301 Commit: 1a0e9c0300 Workload version: 8.0.300-manifests.011fccd5 MSBuild version: 17.10.4+10fbfbf2eRuntime Environment: OS Name: Windows OS Version: 10.0.22631 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.301\.NET workloads installed: [aspire] Installation Source: SDK 8.0.300, VS 17.10.34928.147 Manifest Version: 8.0.1/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.0.1\WorkloadManifest.json Install Type: Msi [wasm-tools] Installation Source: SDK 8.0.300, VS 17.10.34928.147 Manifest Version: 8.0.6/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.workload.mono.toolchain.current\8.0.6\WorkloadManifest.json Install Type: MsiHost: Version: 8.0.6 Architecture: x64 Commit: 3b8b000a0e.NET SDKs installed: 8.0.100-rc.2.23502.2 [C:\Program Files\dotnet\sdk] 8.0.200 [C:\Program Files\dotnet\sdk] 8.0.300 [C:\Program Files\dotnet\sdk] 8.0.301 [C:\Program Files\dotnet\sdk].NET runtimes installed: Microsoft.AspNetCore.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.0-rc.2.23480.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.0-rc.2.23479.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.0-rc.2.23479.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]Environment variables: Not setglobal.json file: Not foundC:\Program Files\dotnet\sdk\8.0.301\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets\Microsoft.NET.Sdk.StaticWebAssets.Publish.targets(25,5): error : Conflicting assets with the same target path 'Web.Admin.Client/_framework/Microsoft.EntityFrameworkCore.Relational.wasm.br'. For 'Publish' assets 'Identity: solution\Web.Admin.Client\obj\Local\net8.0\compressed\publish\0pitllaw99.brSourceType: ProjectSourceId: Web.Admin.ClientContentRoot: solution\publish\Web\wwwroot\BasePath: Web.Admin.ClientRelativePath: _framework/Microsoft.EntityFrameworkCore.Relational.wasm.brAssetKind: PublishAssetMode: AllAssetRole: AlternativeAssetRole: AssetRole: RelatedAsset: solution\Web.Admin.Client\obj\Local\net8.0\webcil\publish\Microsoft.EntityFrameworkCore.Relational.wasmAssetTraitName: Content-EncodingAssetTraitValue: brCopyToOutputDirectory: NeverCopyToPublishDirectory: PreserveNewestOriginalItemSpec: solution\Web.Admin.Client\obj\Local\net8.0\webcil\publish\Microsoft.EntityFrameworkCore.Relational.wasm'and'Identity: solution\Web.Client\obj\Local\net8.0\compressed\publish\ekk7igjstw.brSourceType: ProjectSourceId: Web.Admin.ClientContentRoot: solution\publish\Web\wwwroot\BasePath: Web.Admin.ClientRelativePath: _framework/Microsoft.FEntityFrameworkCore.Relational.wasm.brAssetKind: PublishAssetMode: AllAssetRole: AlternativeAssetRole: AssetRole: RelatedAsset: solution\Web.Client\obj\Local\net8.0\webcil\publish\Microsoft.EntityFrameworkCore.Relational.wasmAssetTraitName: Content-EncodingAssetTraitValue: brCopyToOutputDirectory: NeverCopyToPublishDirectory: PreserveNewestOriginalItemSpec: solution\Web.Client\obj\Local\net8.0\webcil\publish\Microsoft.EntityFrameworkCore.Relational.wasm'.I am working to create a minimum reproducible example but as of yet have not succeeded -- I am very confused and going bald. Thank you in advance for any and all help -- it is appreciated.