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