Skip to content

Instantly share code, notes, and snippets.

@noseratio
Last active May 2, 2023 11:24
Show Gist options
  • Save noseratio/c42d58049338e67a4c65d6ac552f2d07 to your computer and use it in GitHub Desktop.
Save noseratio/c42d58049338e67a4c65d6ac552f2d07 to your computer and use it in GitHub Desktop.
Combine AspNetCore, WebView2 and WPF in the same NET 5 Desktop project
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<OutputType>Exe</OutputType>
<DisableWinExeOutputInference>true</DisableWinExeOutputInference>
<UseWPF>true</UseWPF>
<UsingMicrosoftNETSdkWeb>true</UsingMicrosoftNETSdkWeb>
<StartupObject>WebView2AppKeys.Program</StartupObject>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<Version>1.0.0</Version>
<ApplicationIcon />
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" IsImplicitlyDefined="true" />
</ItemGroup>
<ItemGroup>
<None Remove="test.html" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.818.41" />
</ItemGroup>
<ItemGroup>
<Content Include="test.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment