Blazor WebAssembly build suddenly breaking

Build failing on Netlify but working fine on my local (Win, WinWSL2, macOS and Linux). Yes, I have all these OSs available on my local.

Website: festive-hodgkin-f5fb52 (www.celsojr.com)

Build setting that was working fine for the previous builds:

This is not JavaScript, but instead Blazor WebAssembly.

The issue reported by the logging is not real. The file, type, namespace or whatever, is there. I already tried to replace it. I already tried to remove it. Then other issues will come with no reason because this is working fine on my local. I couldn’t reproduce this thing at all.

The WinWSL2 is very close to the Netlify build image, same MSBuild version, same OS version Ubuntu (focal). But still working fine locally.

I also tried to remove the deploy cache, I tried even to delete the problematic deploys. But still no success.

Build log:
8:23:05 AM: Netlify Build
8:23:05 AM: ────────────────────────────────────────────────────────────────
8:23:05 AM: ​
8:23:05 AM: ❯ Version
8:23:05 AM: @netlify/build 29.55.4
8:23:05 AM: ​
8:23:05 AM: ❯ Flags
8:23:05 AM: accountId: 6198e83a89c930171cfa65f4
8:23:05 AM: baseRelDir: true
8:23:05 AM: buildId: 671b1d056b50e8000859febb
8:23:05 AM: deployId: 671b1d056b50e8000859febd
8:23:05 AM: ​
8:23:05 AM: ❯ Current directory
8:23:05 AM: /opt/build/repo
8:23:05 AM: ​
8:23:05 AM: ❯ Config file
8:23:05 AM: /opt/build/repo/netlify.toml
8:23:05 AM: ​
8:23:05 AM: ❯ Context
8:23:05 AM: production
8:23:05 AM: ​
8:23:05 AM: Build command from Netlify app
8:23:05 AM: ────────────────────────────────────────────────────────────────
8:23:05 AM: ​
8:23:05 AM: $ dotnet publish -c Release -o release
8:23:05 AM: MSBuild version 17.3.4+a400405ba for .NET
8:23:06 AM: Determining projects to restore…
8:23:08 AM: Restored /opt/build/repo/src/celsojr.wasm/celsojr.wasm.csproj (in 2.24 sec).
8:23:11 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
8:23:11 AM: /opt/build/repo/src/celsojr.wasm/Microsoft.NET.Sdk.Razor.SourceGenerators/Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator/Pages_Admin_Login_razor.g.cs(145,61): error CS0246: The type or namespace name ‘EmptyLayout’ could not be found (are you missing a using directive or an assembly reference?) [/opt/build/repo/src/celsojr.wasm/celsojr.wasm.csproj]
8:23:11 AM: ​
8:23:11 AM: “build.command” failed
8:23:11 AM: ────────────────────────────────────────────────────────────────
8:23:11 AM: ​
8:23:11 AM: Error message
8:23:11 AM: Command failed with exit code 1: dotnet publish -c Release -o release (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
8:23:11 AM: ​
8:23:11 AM: Error location
8:23:11 AM: In Build command from Netlify app:
8:23:11 AM: dotnet publish -c Release -o release
8:23:11 AM: ​
8:23:11 AM: Resolved config
8:23:11 AM: build:
8:23:11 AM: command: dotnet publish -c Release -o release
8:23:11 AM: commandOrigin: ui
8:23:11 AM: publish: /opt/build/repo/release/wwwroot
8:23:11 AM: publishOrigin: ui
8:23:11 AM: redirects:
8:23:11 AM: - from: /*
status: 200
to: index.html
redirectsOrigin: config
8:23:11 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:23:11 AM: Failing build: Failed to build site
8:23:12 AM: Finished processing build request in 25.582s

I have published a different Blazor Wasm sample app to the GitHub Pages for testing purposes.

Also static website hosting, but the source must be kept public.

Similar build script: BlazorApp/.github/workflows/main.yml at master · celsojr/BlazorApp · GitHub.

Working like a charm: GitHub - celsojr/BlazorApp: Blazor wasm example app

Perhaps there is something wrong with the behavior of the build/app in the Netlify host environment, but I don’t know how to troubleshoot it.

Not sure if there’s much we can check without a repo, could you share one?

Of course I can share it because this site is still an experiment and still in the early stages of development.

But the only reason I chose Netlify over other static site hosts was for privacy and so I could keep my source code private. That said, I simply don’t want to share the repository on this public forum.

Does this forum support DM?

If not, could you share a support form or an email so I can send you the zipped source files?

DM with zip file sent!

Thanks in advance!

Okay. I think I found the issue!

Let me just confirm and I’ll come back with more details…

Alright, let us know if you still need help and I’ll check the repo.

Confirmed! No problem with Netlify or the hosting environment!

Well, thank you for your replies @hrishikesh, but I think there is nothing we can do now.

For the God’s sake, it seems these things only happen to me! Haha.

Perhaps this is the time for a small project update. Let’s see…

But let me try to explain in case some else is facing similar issue:

As I said on my first post, I’m working with multiple different OSs. At home, on my PC with Window and WSL2. Outside, with my MacBook Air M1. Then during the development process, my project’s folder names underwent some changes, which led to a small but impactful case-sensitivity issue. My local environment didn’t catch this because Windows treats folders as case-insensitive, but GitHub environment (on Linux) requires exact matches. When the code was pushed to GitHub, it registered the different cases and created duplicate directories as you can see in the screenshot below:

This start happening after an IDE update I did locally which of course has also changed the .sln file for this project:

I couldn’t reproduce the issue locally because, as I know I’m working with different filesystems, my Git configuration was set to ignorecase true, as you can see:

Screenshot 2024-10-27 033909

And while the WSL2 is technically case-sensitive, if your Git configuration in WSL2 is still set to core.ignorecase true, it may behave similarly to Windows in terms of ignoring casing in file names.
Additionally, if the code is stored on a Windows filesystem (such as /mnt/c), then it inherits the case-insensitivity of the Windows NTFS file system, even when accessed from WSL2.

Now, I’m facing two problems:

  1. Project is working fine on my local after adding the components. My Git config was core.ignorecase true. But a new parent folder is being created on GitHub after pushing.

  2. If I try to rename the local parent folders, then I’m experiencing issues with the MSBuild and Source Generators for this Blazor Wasm project and I’m not able to build locally because I’m getting this little gift below:

For those who don’t know about Source Generators, they are basically project files that are automatically generated at compile time, before the runtime. And we can’t change them.

I think the easiest way to fix this is to create a completely new project from scratch, because this project is small and I don’t deserve to waste my time trying to resolve complex conflicts. But I think I will also try to report to Microsoft later because Source Generators is blocking the renaming of parent folders in a way that we can’t fix manually.

That was all.

Thank you very much for your time @hrishikesh.

And please let me know if you guys here in this forum need further clarification or help with similar issues.