TypeScript Compilation in Razor Class Library causes build to fail in referencing projects
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
A Razor Class Library with TypeScript files does not consistently build successfully in .NET 9+
### To Reproduce
[Repro Project](https://github.com/dymaptic/TypeScriptBuildIssueDemo)
1. Clone the repository.
2. Open the solution in Visual Studio 2022 or later.
3. Build the solution or main project (Blazor app `TypeScriptBuildIssueDemo`).
4. Right-click and Re-build the solution or main project.
This is also reproducible in VSCode and JetBrains Rider. However, it does not appear to be reproducible from the command line.
Likely this points to an issue with the parallel build processes of the IDEs.
### Exceptions
You should see the build failing alternating times with the following error:
```
System.InvalidOperationException: No file exists for the asset at either location 'D:\TypeScriptBuildIssueDemo\TypeScriptBuildIssueDemo.Library\wwwroot\js\app.js' or 'wwwroot\js\app.js'.
at Microsoft.AspNetCore.StaticWebAssets.Tasks.StaticWebAsset.ResolveFile(String identity, String originalItemSpec)
at Microsoft.AspNetCore.StaticWebAssets.Tasks.DefineStaticWebAssets.ResolveFileDetails(String originalItemSpec, String identity)
at Microsoft.AspNetCore.StaticWebAssets.Tasks.DefineStaticWebAssets.Execute()
```
### Further technical details
details of dotnet --info
.NET SDK:
Version: 10.0.100-preview.6.25358.103
Commit: 75972a5ba7
Workload version: 10.0.100-manifests.6616851e
MSBuild version: 17.15.0-preview-25358-103+75972a5ba
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.100-preview.6.25358.103\
.NET workloads installed:
[maccatalyst]
Installation Source: VS 17.14.36221.1
Manifest Version: 18.4.10622-net10-p5/10.0.100-preview.5
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100-preview.5\microsoft.net.sdk.maccatalyst\18.4.10622-net10-p5\WorkloadManifest.json
Install Type: Msi
[android]
Installation Source: VS 17.14.36221.1
Manifest Version: 36.0.0-preview.5.116/10.0.100-preview.5
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100-preview.5\microsoft.net.sdk.android\36.0.0-preview.5.116\WorkloadManifest.json
Install Type: Msi
[maui-windows]
Installation Source: VS 17.14.36221.1
Manifest Version: 10.0.0-preview.5.25306.5/10.0.100-preview.5
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100-preview.5\microsoft.net.sdk.maui\10.0.0-preview.5.25306.5\WorkloadManifest.json
Install Type: Msi
[ios]
Installation Source: VS 17.14.36221.1
Manifest Version: 18.4.10622-net10-p5/10.0.100-preview.5
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100-preview.5\microsoft.net.sdk.ios\18.4.10622-net10-p5\WorkloadManifest.json
Install Type: Msi
Configured to use workload sets when installing new manifests.
Workloads are configured to install and update using workload versions, but none were found. Run "dotnet workload restore" to install a workload version.
Host:
Version: 10.0.0-preview.6.25358.103
Architecture: x64
Commit: 75972a5ba7
.NET SDKs installed:
8.0.412 [C:\Program Files\dotnet\sdk]
9.0.205 [C:\Program Files\dotnet\sdk]
9.0.301 [C:\Program Files\dotnet\sdk]
10.0.100-preview.6.25358.103 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0-preview.6.25358.103 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0-preview.6.25358.103 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.0-preview.6.25358.103 [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 set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
- Visual Studio Version 17.14.7, Windows 11 version 10.0.26100
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.