-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
While setting up CI for a Blazor app, the build succeeds on Windows PCs and runners but fails on a GitHub Actions Linux runner with multiple BLAZOR106 errors for .razor.js files generated from isolated .ts modules. We rely exclusively on TypeScript for type safety and maintainability, and module isolation is one of the reasons we’re migrating from Node/React to Blazor. Linux runners are also essential for integration into our existing CI and tooling.
A sample from the build output (see links below for the actual logs)
Task "ApplyJsModules"
.../Pages/Index.razor.js : error BLAZOR106: The JS module file '/home/runner/work/.../Pages/Index.razor.js' was defined but no associated razor component or view was found for it. [/home/runner/work/.../Project.Client.csproj]
Done executing task "ApplyJsModules" -- FAILED.
Done building target "ResolveJSModuleStaticWebAssets" in project "Project.Client.csproj" -- FAILED.
TypeScript modules *.razor.ts (and other isolated TS files) are compiled to *.razor.js using MSBuild TypeScript. Including or excluding the .ts/.js files from the project does not change the outcome. It could be confirmed that the .razor.js files are generated by TSC.
Expected Behavior
dotnet build should succeed on Linux the same way it does on Windows (no BLAZOR106 for valid component-scoped JS modules).
Steps To Reproduce
- Create Blazor web app
- Add isolated client-side scripts as *.razor.ts alongside components (Pages/Index.razor.ts)
- Add Microsoft.TypeScript.MSBuild and use any sample TS configation.
Build locally on Windows succeeds. Build on Linux emits BLAZOR106 for each generated *.razor.js.
Sample repo
https://github.com/alexuaua/DotnetBuildUbunuRunnerIssue
Linux runner (no details)
https://github.com/alexuaua/DotnetBuildUbunuRunnerIssue/actions/runs/17163243937/job/48697388920
Linux runner (detailed output)
https://github.com/alexuaua/DotnetBuildUbunuRunnerIssue/actions/runs/17163286512/job/48697526948
Windows runner
https://github.com/alexuaua/DotnetBuildUbunuRunnerIssue/actions/runs/17163311635/job/48697607757
Exceptions (if any)
No response
.NET Version
9.0.304
Anything else?
I've checked these bug reports:
- Blazor 6 : "Microsoft.TypeScript.MSBuild" and a collocated JavaScript file with a .razor file cause a build error on the Ubuntu #40640
These seems to be very related, but it is closed as fixed and/or no workaround is provided.
These also seem to be related, but I don't have issues on Windows. - Unexpected BLAZOR106 error when adding static script files to razor pages project #57324
- Include javascript files associated with Blazor components when using MapStaticAssets #59038
- Rebuild fails when fingerprinting compiled TypeScript in VS 17.12.0 #58948
dotnet --info:
.NET SDK:
Version: 9.0.304
Commit: f12f5f689e
Workload version: 9.0.300-manifests.70d87660
MSBuild version: 17.14.16+5d8159c5f
Runtime Environment:
OS Name: ubuntu
OS Version: 24.04
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/9.0.304/
.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.8
Architecture: x64
Commit: aae90fa090
.NET SDKs installed:
9.0.304 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.19 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_ROOT [/usr/share/dotnet]
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
9.0.304
Also please see the links above for detailed build logs.