Skip to main content
This guide makes a setup file for a .NET desktop app, such as a WPF or Windows Forms program, or a console tool.

1. Decide about the .NET runtime

A .NET app needs the .NET runtime. You can handle that in two ways:
  • Self-contained: the runtime is part of your build folder. Users need nothing else. The setup file gets bigger.
  • Framework-dependent: your app is small, but the right .NET runtime must be installed on the user’s computer. Bach can check for it and tell the user where to get it.

2. Publish

Either way, the result is in bin/Release/<framework>/win-x64/publish, for example bin/Release/net8.0-windows/win-x64/publish.

3. Create bach.toml

Run this in the folder with your .csproj:
Bach reads the project file: Product or the assembly name, Version, Company or Authors, and the target framework. For a WPF app on .NET 8 you get (without the commented-out options):
bach.toml
The requirement starts commented out, which is right for a self-contained publish. That’s also what the release workflow does. If you publish framework-dependent, uncomment the block, so the installer checks for the runtime.
Bach 0.11.3 and earlier wrote the block uncommented. If you publish self-contained, delete it, or the installer asks users to install a runtime your app already carries.
desktop = true checks for the .NET Desktop Runtime, which WPF and Windows Forms apps need. It’s set when your target framework ends in -windows.

4. Check and build

Next steps