Converting Existing ASP.NET Core Web Application to a Local Desktop Application?

fatih uyanık 245 Reputation points
2025-12-05T06:43:54.2266667+00:00

Hello everyone,

I currently have a working ASP.NET Core (.NET 8) web application. My goal is to preserve the application's existing HTML/CSS/JavaScript interface and C# business logic (DI, Services, EF Core, etc.) while transforming it into an independent Windows desktop application, similar to WinForms/WPF.

The application must be distributable as an .exe and should not require an external web server.

I'm focusing on two main candidate technologies for this conversion but am struggling to understand the key differences between them.

Key Deciding Factors and Questions

  1. Blazor Hybrid (WPF/WinForms) Approach:

• This approach ensures my C# business logic runs as a fully native .NET process, with the UI displayed inside a WebView2 control.

• Question: Does this method guarantee that my C# code will run at full native performance and easily allow access to desktop capabilities like local file system access?

  1. Electron.NET Approach:

• This approach embeds my web application into a Chromium/Node.js shell (Electron) to port it to the desktop.

• Question: When using Electron.NET, does my C# code (API layer) still run on a Kestrel server in the background? Or does this solution also run as a completely native process? What are the performance disadvantages compared to Blazor Hybrid?

  1. Service Integration (DI):

• What is the best practice for porting my existing ASP.NET Core DI definitions (IServiceCollection registrations) to the new desktop project's startup point (Program.cs or App.xaml.cs) without rewriting them? (Adhering to the DRY principle.)

In summary: Which solution—Blazor Hybrid or Electron.NET—offers a more efficient and seamless experience for a Windows-only target with a .NET 8 project, while preserving the strength of my existing C# codebase (DI and performance)?

I would appreciate advice from experienced colleagues, especially regarding ease of distribution and local API access.

Thank you.

Developer technologies | .NET | Blazor
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. AgaveJoe 30,406 Reputation points
    2025-12-05T15:36:54.63+00:00

    File System Access Standard web apps can't access client files because the code executes on a remote server. However, with either Electron.NET or Blazor Hybrid, your code executes locally on the user's machine. This means you will have full native access to the file system (System.IO) regardless of which path you choose.

    Electron.NET vs. Blazor Hybrid

    Electron.NET: This is a true "Lift & Shift" solution. Because it runs a real Kestrel server in the background, your existing Controllers, Routes, and .cshtml Views work exactly as they do now. The trade-off: It is heavy. You are running the .NET Runtime + Node.js + Chromium. Expect 150MB+ RAM usage even for a simple app.

    Blazor Hybrid: If your current UI relies on MVC or Razor Pages (.cshtml), you cannot simply drop it into Blazor Hybrid. You would need to rewrite the UI layer into Blazor Components (.razor). While this approach is much lighter on system resources, the migration effort is significantly higher.

    Dependency Injection (DI) You generally shouldn't worry about porting your DI. Since DI is just interfaces and implementations, your existing logic is fully reusable in a desktop environment. The only code you might need to refactor is anything relying on web-specific features like Cookies or Session state, as those concepts don't translate directly to desktop apps.

    0 comments No comments

  2. Bruce (SqlWork.com) 81,976 Reputation points Volunteer Moderator
    2025-12-07T18:57:08.3866667+00:00

    The electron.net is most compatible with your current code. Yes it does run a kestrel server and will require an TCP/IP port and will be a two process application.

    Hybrid Blazor does not use an internal webserver and is a single process application. But you would need to rewrite your code to Blazor. You could convert your core app to Blazor, but check the tradeoffs first.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.