Electron.NET Core 0.3.1 fail to compile base Blazor Web project #1044

Closed
opened 2026-01-29 16:56:26 +00:00 by claunia · 9 comments
Owner

Originally created by @Denny09310 on GitHub (Dec 17, 2025).

Description

After upgrading Electron.NET Core from 0.3.0 to 0.3.1, the build fails with an exception related to missing metadata for generated static assets.

Environment

  • Electron.NET Core: 0.3.1
  • .NET SDK: 10
  • Node.js: 24.12.0
  • Target Runtime: win-x64

Error Message

No metadata 'SourceId' was present for item 'Components\Layout\ReconnectModal.razor.js' and no default value was provided.

I have observed the same issue in another project, where the error referenced different generated assets, such as:

  • *.razor.js
  • app.css

Expected Behavior

The project should build successfully after upgrading Electron.NET Core from 0.3.0 to 0.3.1.

Actual Behavior

The build fails with a SourceId metadata exception related to generated static web assets.

Steps to Reproduce

  1. Create a new Blazor Web project.
  2. Add Electron.NET.
  3. Build the project.

Additional Notes

I've also saw that when re-opening the project the file affected by this exception can change, for example now it's "Components\Layout\MainLayout.razor.rz.scp.css", no idea how it calculates this static assets

electron-sample.zip

Originally created by @Denny09310 on GitHub (Dec 17, 2025). ### Description After upgrading **Electron.NET Core** from **0.3.0** to **0.3.1**, the build fails with an exception related to missing metadata for generated static assets. ### Environment * **Electron.NET Core**: 0.3.1 * **.NET SDK**: 10 * **Node.js**: 24.12.0 * **Target Runtime**: win-x64 ### Error Message ``` No metadata 'SourceId' was present for item 'Components\Layout\ReconnectModal.razor.js' and no default value was provided. ``` I have observed the same issue in another project, where the error referenced different generated assets, such as: * `*.razor.js` * `app.css` ### Expected Behavior The project should build successfully after upgrading Electron.NET Core from 0.3.0 to 0.3.1. ### Actual Behavior The build fails with a `SourceId` metadata exception related to generated static web assets. ### Steps to Reproduce 1. Create a new **Blazor Web** project. 2. Add **Electron.NET**. 3. Build the project. ### Additional Notes I've also saw that when re-opening the project the file affected by this exception can change, for example now it's "Components\Layout\MainLayout.razor.rz.scp.css", no idea how it calculates this static assets [electron-sample.zip](https://github.com/user-attachments/files/24217021/electron-sample.zip)
claunia added the bug label 2026-01-29 16:56:26 +00:00
Author
Owner

@softworkz commented on GitHub (Dec 17, 2025):

Does it get fixed when you add this:

<PackageId>$(ElectronPackageId)</PackageId>

to a PropertyGroup in the .csproj file`?

@softworkz commented on GitHub (Dec 17, 2025): Does it get fixed when you add this: ```xml <PackageId>$(ElectronPackageId)</PackageId> ``` to a PropertyGroup in the .csproj file`?
Author
Owner

@markatosi commented on GitHub (Dec 18, 2025):

Yes, that resolves the issue for me

@markatosi commented on GitHub (Dec 18, 2025): Yes, that resolves the issue for me
Author
Owner

@Denny09310 commented on GitHub (Dec 18, 2025):

Yes that solves the issue! Thanks

@Denny09310 commented on GitHub (Dec 18, 2025): Yes that solves the issue! Thanks
Author
Owner

@sboulema-nwwi commented on GitHub (Dec 18, 2025):

The mentioned fix does indeed fix the build of my project but upon publishing I encounter this error:

C:\Users\runneradmin\.nuget\packages\electronnet.core\0.3.1\build\ElectronNET.LateImport.targets(430,7): error MSB4184: The expression "[System.IO.Path]::GetFullPath('')" cannot be evaluated. The path is empty. (Parameter 'path') [<redacted>.csproj]

Command to publish:
dotnet publish -p:PublishProfile=win-x64

Publish profile:

<?xml version="1.0" encoding="utf-8"?>
<Project>
	<PropertyGroup>
		<Configuration>Release</Configuration>
		<Platform>Any CPU</Platform>
		<PublishDir>publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\</PublishDir>
		<PublishProtocol>FileSystem</PublishProtocol>
		<TargetFramework>net10.0</TargetFramework>
		<RuntimeIdentifier>win-x64</RuntimeIdentifier>
		<SelfContained>true</SelfContained>
		<PublishSingleFile>false</PublishSingleFile>
		<WebPublishMethod>FileSystem</WebPublishMethod>
	</PropertyGroup>
</Project>
@sboulema-nwwi commented on GitHub (Dec 18, 2025): The mentioned fix does indeed fix the build of my project but upon publishing I encounter this error: ``` C:\Users\runneradmin\.nuget\packages\electronnet.core\0.3.1\build\ElectronNET.LateImport.targets(430,7): error MSB4184: The expression "[System.IO.Path]::GetFullPath('')" cannot be evaluated. The path is empty. (Parameter 'path') [<redacted>.csproj] ``` Command to publish: `dotnet publish -p:PublishProfile=win-x64` Publish profile: ``` <?xml version="1.0" encoding="utf-8"?> <Project> <PropertyGroup> <Configuration>Release</Configuration> <Platform>Any CPU</Platform> <PublishDir>publish\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\</PublishDir> <PublishProtocol>FileSystem</PublishProtocol> <TargetFramework>net10.0</TargetFramework> <RuntimeIdentifier>win-x64</RuntimeIdentifier> <SelfContained>true</SelfContained> <PublishSingleFile>false</PublishSingleFile> <WebPublishMethod>FileSystem</WebPublishMethod> </PropertyGroup> </Project> ```
Author
Owner

@FlorianRappl commented on GitHub (Dec 18, 2025):

@sboulema-nwwi sounds rather like an old version. We had this in 0.2 - can you make sure that you have a proper publish profile (it looks different to https://github.com/ElectronNET/Electron.NET/wiki/Package-Building#aspnet-application-profile-windows - e.g., PublishUrl is missing (there is PublishDir which would only be used for a console application).

@FlorianRappl commented on GitHub (Dec 18, 2025): @sboulema-nwwi sounds rather like an old version. We had this in 0.2 - can you make sure that you have a proper publish profile (it looks different to https://github.com/ElectronNET/Electron.NET/wiki/Package-Building#aspnet-application-profile-windows - e.g., `PublishUrl` is missing (there is `PublishDir` which would only be used for a console application).
Author
Owner

@sboulema-nwwi commented on GitHub (Dec 18, 2025):

Thanks for the quick answer!
Recreating the publish profiles as indicated fixed the problem.

@sboulema-nwwi commented on GitHub (Dec 18, 2025): Thanks for the quick answer! Recreating the publish profiles as indicated fixed the problem.
Author
Owner

@softworkz commented on GitHub (Dec 18, 2025):

@Denny09310 @markatosi

This PR Set PackageId from ElectronPackageId #995 should fix it.
When it's out in a new package, please test whether you can remove that property assignment.

Thanks

@softworkz commented on GitHub (Dec 18, 2025): @Denny09310 @markatosi This PR [Set PackageId from ElectronPackageId #995](https://github.com/ElectronNET/Electron.NET/pull/995) should fix it. When it's out in a new package, please test whether you can remove that property assignment. Thanks
Author
Owner

@Denny09310 commented on GitHub (Dec 19, 2025):

@softworkz I can confirm that updating to v0.4.0 makes the project compile correctly

@Denny09310 commented on GitHub (Dec 19, 2025): @softworkz I can confirm that updating to v0.4.0 makes the project compile correctly
Author
Owner

@softworkz commented on GitHub (Dec 19, 2025):

Awesome, thanks a lot for confirming!

@softworkz commented on GitHub (Dec 19, 2025): Awesome, thanks a lot for confirming!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#1044