-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
ExternalThis is an issue in a component not contained in this repository. It is open for tracking purposes.This is an issue in a component not contained in this repository. It is open for tracking purposes.area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Componentsfeature-static-web-assets
Description
Describe the bug
On the Ubuntu Linux 20.04 LTS, for a Blazor WebAssembly project (.NET 6) with the following conditions, 2nd time or later of execution, dotnet build
command causes the build error "Two assets found targeting the same path with incompatible asset kinds".
- The project references "Microsoft.TypeScript.MSBuild" NuGet package.
- The project contains .razor.js files that are collocated with .razor files.
- The project also contains .razor.ts files, and they are transpiled to the .razor.js files above.
Notice:
- I encountered this problem with the .NET SDK 6.0.x on Ubuntu Linux 20.04 LTS on WSL2 on my Windows 11 Pro 21H2 x64, and GitHub Actions of
ubuntu-latest
. - The build error never occurred on Windows OS. (I don't know the case on a macOS because I could not try it on macOS.)
- The 1st execution of the
dotnet build
was completed successfully whether runs on Ubuntu or Windows. - It seems the error happens only when the transpiled .razor.js files already exist before the build has been started.
- If I do not use TypeScript for collocated JavaScript with Razor component, the build error never occurred even though I continue using TypeScript for located JavaScript under the "wwwroot" folder.
- At that time, I used "Microsoft.TypeScript.MSBuild" NuGet package version 4.6.2, but in my case, the build error seems to happen even another version of "Microsoft.TypeScript.MSBuild" NuGet package such as version 3.x.
To Reproduce
Requirements
- Use the minimal project below that can reproduce this problem.
- Prepare a Ubuntu Linux 20.04 LTS and install the .NET SDK 6.0.201 in it.
Steps to reproduce
- Open a terminal on the Ubuntu Linux 20.04 LTS.
- Change the current directory to where you extracted the "BlazorCollocateJsWithRazor-net-sdk-6.0.201.zip" file.
- Execute
dotnet build command
and confirm it will be a success. - Execute
dotnet build command
one more time, then you will see the build error.
Exceptions (if any)
The build error message is below:
/usr/share/dotnet/sdk/6.0.201/Sdks/Microsoft.NET.Sdk.Razor/targets/Microsoft.NET.Sdk.Razor.JSModules.targets(95,5): error : Two assets found targeting the same path with incompatible asset kinds: [/mnt/c/Projects/Blazor/Trials/BlazorCollocateJsWithRazor/BlazorCollocateJsWithRazor.csproj]
/usr/share/dotnet/sdk/6.0.201/Sdks/Microsoft.NET.Sdk.Razor/targets/Microsoft.NET.Sdk.Razor.JSModules.targets(95,5): error : '/mnt/c/Projects/Blazor/Trials/BlazorCollocateJsWithRazor/App.razor.js' with kind 'All' [/mnt/c/Projects/Blazor/Trials/BlazorCollocateJsWithRazor/BlazorCollocateJsWithRazor.csproj]
/usr/share/dotnet/sdk/6.0.201/Sdks/Microsoft.NET.Sdk.Razor/targets/Microsoft.NET.Sdk.Razor.JSModules.targets(95,5): error : '/mnt/c/Projects/Blazor/Trials/BlazorCollocateJsWithRazor/App.razor.js' with kind 'All' [/mnt/c/Projects/Blazor/Trials/BlazorCollocateJsWithRazor/BlazorCollocateJsWithRazor.csproj]
/usr/share/dotnet/sdk/6.0.201/Sdks/Microsoft.NET.Sdk.Razor/targets/Microsoft.NET.Sdk.Razor.JSModules.targets(95,5): error : for path 'App.razor.js' [/mnt/c/Projects/Blazor/Trials/BlazorCollocateJsWithRazor/BlazorCollocateJsWithRazor.csproj]
Further technical details
dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.201
Commit: ef40e6aa06
Runtime Environment:
OS Name: ubuntu
OS Version: 20.04
OS Platform: Linux
RID: ubuntu.20.04-x64
Base Path: /usr/share/dotnet/sdk/6.0.201/
Host (useful for support):
Version: 6.0.3
Commit: c24d9a9c91
.NET SDKs installed:
5.0.406 [/usr/share/dotnet/sdk]
6.0.201 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.15 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.15 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Metadata
Metadata
Assignees
Labels
ExternalThis is an issue in a component not contained in this repository. It is open for tracking purposes.This is an issue in a component not contained in this repository. It is open for tracking purposes.area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Componentsfeature-static-web-assets