How to electronize an ASP.NET Core hosted Blazor WebAssembly app

1.9k Views Asked by At

I have created a new Blazor WebAssembly project and made it ASP.NET Core hosted (so, Visual Studio created three projects, one for the server, the actual WebAssembly client project, as well as a class library holding types used by both apps). Then, I just followed the documentation at https://github.com/ElectronNET/Electron.NET to electronize the server app. In theory, everything should be fine.

Problems occur when I try to run the app via electronize start. The build fails with the following error.

...Microsoft.NET.ILLink.targets(143,5): error NETSDK1102: Optimizing assemblies for size is not supported for the select
ed publish configuration. Please ensure that you are publishing a self-contained app. ...
Error occurred during dotnet publish: 1

Of course, I can imagine what the actual problem is. The Electron build tries to publish the assemblies for the current target platform, which is x64 in my case, but this is not supported for blazor-wasm projects. What I basically want to achieve is that the client build output gets included with the electronized server app.

Update

The following command successfully builds the electronized app, if the PublishSingleFile and PublishReadyToRun properties are set to false. Though, this is far from optimal since it creates an app that comes with a performance penalty (increased load time).

electronize build /target win /PublishSingleFile false /PublishReadyToRun false

Sadly, the switches currently do not work with the electronize start command.

0

There are 0 best solutions below