Build desktop apps with an ASP.NET Core backend and any JavaScript UI (Angular, React, Vue, ...), Tauri-style — but with .NET instead of Rust, and with real MVC instead of invoke('command').
The full ASP.NET Core pipeline (controllers, minimal APIs, model binding, filters, auth, ProblemDetails, JSON) runs in-process with no Kestrel and no TCP port. The system WebView talks to it over two custom schemes:
| Scheme | Purpose | Who uses it |
|---|---|---|
app://localhost |
UI origin: static files + SPA fallback | The WebView loads the app from here |
ipc://localhost |
API origin: your controllers / minimal APIs | Only DesktopHttpClient |
Nothing on the machine can reach your API: there is no socket to connect to.
flowchart LR
spa[Angular / React / Vue]
spa -->|"HttpClient / fetch https://..."| net[Real network]
spa -->|"DesktopHttpClient ipc://localhost/api/..."| webview[System WebView]
webview --> adapter[Platform adapter]
adapter --> server["DesktopServer (IServer)"]
server --> pipeline[ASP.NET Core pipeline]
pipeline --> mvc[Controllers & minimal APIs]
- .NET 10 SDK and Node.js 22 or later.
- The system WebView for your OS (see docs/platforms.md):
- Windows: the WebView2 Runtime, already installed on Windows 11 and current Windows 10.
- macOS 14+:
dotnet workload install macosand the Xcode version that workload asks for. - Linux: GTK 4 and WebKitGTK 6, e.g.
sudo apt install libgtk-4-1 libwebkitgtk-6.0-4on Ubuntu 24.04+.
The templates (Angular, React or Vue) come with the build wiring and hot reload set up:
dotnet new install AlphaSoftware.AspNetDesktop.Templates
dotnet new aspnetdesktop-vue -o MyApp # or: aspnetdesktop-angular, aspnetdesktop-react
cd MyApp
dotnet run -c Release # builds the UI into wwwroot and opens the windowFor hot reload while you work, run the dev server and the app side by side:
cd ClientApp && npm install && npm start # Vite on :5173 (Angular: ng serve on :4200)
dotnet run # from MyApp, in a second terminal: the window loads the dev serverdotnet add package AlphaSoftware.AspNetDesktop
npm install @alpha-software/aspnetdesktop-client # in your frontendvar builder = WebApplication.CreateBuilder(args);
builder.AddDesktopHost(); // replaces Kestrel; no TCP bind
builder.Services.AddControllers();
var app = builder.Build();
app.UseStaticFiles(); // Angular/React/Vue dist served from app://
app.MapControllers(); // real MVC / minimal APIs on ipc://
app.MapFallbackToFile("index.html");
app.RunDesktop(); // opens the window; returns when it closesThe target framework selects the adapter: net10.0-windows uses WebView2, net10.0-macos uses WKWebView, and net10.0 on Linux uses WebKitGTK 6 (platform notes). The templates pick it per OS like this:
<TargetFramework Condition="$([MSBuild]::IsOSPlatform('Windows'))">net10.0-windows</TargetFramework>
<TargetFramework Condition="$([MSBuild]::IsOSPlatform('OSX'))">net10.0-macos</TargetFramework>
<TargetFramework Condition="'$(TargetFramework)' == ''">net10.0</TargetFramework>The framework never patches fetch or Angular's HttpClient. Real HTTP stays real; the desktop API gets its own client from @alpha-software/aspnetdesktop-client.
Angular
// app.config.ts
providers: [provideHttpClient(), provideDesktopHttpClient()]
// component
private http = inject(HttpClient); // https://... over the network
private desktop = inject(DesktopHttpClient); // ipc://localhost, in-process
this.http.get<Weather>('https://api.weather.example/forecast');
this.desktop.get<Metadata>('/api/metadata');
this.desktop.post<Order>('/api/orders', body);DesktopHttpClient is an HttpClient (same get/post/put/patch/delete, generics, params, observe, HttpErrorResponse), constructed with its own backend. Your app's interceptors don't run on it; pass provideDesktopHttpClient({ interceptors: [...] }) for desktop-only ones.
React
// main.tsx
import { DesktopHttpProvider } from '@alpha-software/aspnetdesktop-client/react';
createRoot(root).render(<DesktopHttpProvider><App /></DesktopHttpProvider>);
// component
const desktop = useDesktopHttpClient(); // ipc://localhost, in-process
const metadata = await desktop.get<Metadata>('/api/metadata');
await fetch('https://api.weather.example/forecast'); // real HTTP, untouchedVue
// main.ts
import { createDesktopHttp } from '@alpha-software/aspnetdesktop-client/vue';
createApp(App).use(createDesktopHttp()).mount('#app');
// <script setup>
const desktop = useDesktopHttpClient(); // or this.$desktop in the Options API
const metadata = await desktop.get<Metadata>('/api/metadata');Svelte, Solid, vanilla, ...
import { createDesktopHttpClient, DesktopHttpError } from '@alpha-software/aspnetdesktop-client';
const desktop = createDesktopHttpClient();
try {
await desktop.post<Order>('/api/orders', { product: 'Tea', quantity: 1 });
} catch (e) {
if (e instanceof DesktopHttpError && e.status === 400) showErrors(e.error); // ValidationProblemDetails
}The React, Vue and vanilla clients share one promise-based API (get/post/put/patch/delete/request, DesktopHttpError), so they work directly as a TanStack Query or SWR fetcher. The provider and the plugin also take a client option, so you can swap in a fake in tests.
All clients resolve against window.__ASPNETDESKTOP__.ipcBase (injected by the host) and refuse absolute URLs that aren't on ipc://, so real HTTP can't be sent through them by mistake.
DesktopServer(AlphaSoftware.AspNetDesktop.Hosting) implementsIServer.StartAsyncbinds nothing; it keeps theIHttpApplication<TContext>. Each request gets its ownIFeatureCollection(request, buffered response withOnStarting/OnCompleted, body, lifetime, identifier) and runs through the normal pipeline. Everything aboveIServerworks unchanged.- Adapters turn native WebView requests into
DesktopHttpRequestand call one method:Task<DesktopHttpResponse> ProcessAsync(DesktopHttpRequest request, CancellationToken ct);
- Windows registers
app/ipcwithCoreWebView2CustomSchemeRegistrationbefore the WebView2 environment is created (the piece that makesfetch('ipc://...')work) and answersWebResourceRequestedwith a deferral, so ASP.NET Core runs on the thread pool, not the UI thread. - macOS uses
WKURLSchemeHandlerfor both schemes (method, headers,HTTPBody/HTTPBodyStream). - Linux uses
WebContext.RegisterUriScheme(GetHttpMethod/GetHttpHeaders/GetHttpBody/FinishWithResponse) and marks both schemes secure and CORS-enabled.
- Windows registers
- Scheme-aware routing: endpoints answer on
ipc://only;MapFallback*endpoints answer onapp://only. A relativefetch('/api/x')from the UI lands onindex.html, never on a controller, and an unknownipc://localhost/api/...route is a real 404 rather thanindex.html. Override per endpoint with.RequireDesktopScheme(DesktopScheme.App | DesktopScheme.Ipc)or[RequireDesktopScheme(...)](useful forMapStaticAssets()). CreateClient(): the .NET sibling ofDesktopHttpClient, for tests or in-process callers. It goes through the same security policy:await app.StartAsync(); using HttpClient client = app.CreateDesktopClient(); // BaseAddress = ipc://localhost/ var metadata = await client.GetFromJsonAsync<Metadata>("/api/metadata");
- No loopback socket.
ASPNETCORE_URLS,UseUrls()and launch-profile URLs are ignored; nothing is bound. ipc://checksOriginagainst an allow-list:app://localhostplusDesktop:AllowedOrigins, plusDesktop:DevServerUrlin Development only. Other origins get a 403 without CORS headers.- CORS headers are emitted by the host for allow-listed origins only (never
*); preflights are answered before the pipeline. app://only acceptsGET/HEAD.- Top-level navigation is restricted to
app://localhost(and the dev server in Development).http(s)/mailto/tellinks open in the system browser; everything else (file:,ipc:,javascript:, ...) is blocked.target=_blanknever opens a second window. - Optional defense in depth:
RequireRequestToken = truegenerates a per-process token, exposes it only to UI-origin documents as__ASPNETDESKTOP__.token, and rejectsipc://requests without it. Both clients send it automatically.
Bound from the Desktop section of configuration, then from AddDesktopHost(options => ...):
{
"Desktop": {
"Title": "My App",
"Width": 1280,
"Height": 800,
"Maximized": false,
"StartPath": "/",
"DevServerUrl": "http://localhost:4200",
"AllowedOrigins": [],
"AllowRequestsWithoutOrigin": true,
"RequireRequestToken": false,
"EnableDevTools": null,
"UserDataFolder": null
}
}DevServerUrl only applies when the environment is Development (put it in appsettings.Development.json). EnableDevTools defaults to Development only. The WebView profile defaults to <LocalApplicationData>/<ApplicationName>/WebView.
If your app is started from another working directory, AddDesktopHost() falls back to the wwwroot next to the executable. The samples also set ContentRootPath = AppContext.BaseDirectory so appsettings.json resolves the same way.
| Package | |
|---|---|
AlphaSoftware.AspNetDesktop |
Metapackage: Hosting + the adapter for your target framework, and app.RunDesktop() |
AlphaSoftware.AspNetDesktop.Hosting |
DesktopServer, options, isolation policy, AddDesktopHost(), CreateClient(); no UI dependencies |
AlphaSoftware.AspNetDesktop.Windows / .Mac / .Linux |
Platform adapters |
AlphaSoftware.AspNetDesktop.Templates |
dotnet new aspnetdesktop-angular, aspnetdesktop-react and aspnetdesktop-vue |
@alpha-software/aspnetdesktop-client (npm) |
DesktopHttpClient for Angular, a provider and hook for React, a plugin and composable for Vue, and createDesktopHttpClient() for everything else |
Until 0.1.3 the NuGet packages were published without the AlphaSoftware. prefix (AspNetDesktop, AspNetDesktop.Hosting, ...). Those packages are deprecated. To move to the new ones, replace the package references, uninstall the old templates (dotnet new uninstall AspNetDesktop.Templates), and change using AspNetDesktop... to using AlphaSoftware.AspNetDesktop.... AddDesktopHost() and RunDesktop() are in the ASP.NET Core namespaces, so most apps need no other code changes.
Until 0.1.1 the npm client was published as aspnetdesktop-client, which is deprecated too. Install @alpha-software/aspnetdesktop-client instead and change the imports ('aspnetdesktop-client/react' becomes '@alpha-software/aspnetdesktop-client/react', and the same for /angular, /vue and the core entry point). The API is the same.
Packages are published to nuget.org and npmjs.com only. Releases up to AspNetDesktop 0.1.3 and aspnetdesktop-client 0.1.1 were also on GitHub Packages, under armanossiloko; those copies stay there but get no new versions.
- No WebSockets or SignalR: custom schemes don't upgrade to
ws:. A postMessage transport could come later. - No streaming responses: responses are buffered before they're handed to the WebView.
- One window per app, and no native dialogs, installers or auto-update yet.
Issues and pull requests are welcome. CONTRIBUTING.md covers building from source, the samples and the tests; report security issues privately as described in SECURITY.md. Release notes are on the releases page and in the changelogs for the NuGet packages and the npm client.
MIT, copyright Alpha Software Solutions.
Apps created from the templates credit the project in their footer:
Built with AspNetDesktop by Alpha Software Solutions
Keeping it is appreciated but not required.