This is a scaffold project that allows you to run a WinUI3 application as the host of React web app.
The idea is pretty simple - the WinUI3 holds a WebView2
component with its
source set to a local web server. The web server serves the React app and other
assets.
- No additional web server process is required. The web server is a part of the WinUI3 app.
- React router is supported.
- MSIX packaging is configured. The web app will be bundled into the AppX package along with the WinUI3.
- Install the prerequisites:
- Node.js
- Yarn (You'll need to change the build script if using other package managers such as NPM)
- Visual Studio 2022
- Windows App SDK
- Clone the repo
cd
into thewebapp
folder- Run
yarn
(ornpm install
if you prefer npm) - Open the solution in Visual Studio 2022
- For DEBUGGING
- In a terminal process, run
yarn start
(ornpm start
) in thewebapp
folder. - Press F5 in Visual Studio 2022 to start the app.
- In a terminal process, run
- For RELEASE
⚠️ Note: If you choose NPM over Yarn, please update the filebuild-webapp.ps1
by changingyarn build
tonpm run build
.- Just run or publish the app as you would normally do. There's no need to build the web app manually.
- You'll notice the web app is built when building the CS project, if you look to the build output window.