Build conflicts caused by standalone WebView2 and embedded WebView2 (in Windows App SDK)
Describe the bug
Hi,
Can someone please help me on determining why I am having file conflict issues with WebView2.Core.dll? Below is my csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<TargetPlatformMinVersion>10.0.22621.0</TargetPlatformMinVersion>
<RootNamespace>Schoolr</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;ARM64</Platforms>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<PublishProfile>win10-$(Platform).pubxml</PublishProfile>
<UseWinUI>true</UseWinUI>
<EnableMsixTooling>true</EnableMsixTooling>
<SupportedOSPlatformVersion>10.0.22621.0</SupportedOSPlatformVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
**<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>**
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.CameraPreview" Version="8.0.240109" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.Sizers" Version="8.0.240109" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0-preview.1.24081.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0-preview.1.24081.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0-preview.1.24081.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.49-beta">
<PrivateAssets>all</PrivateAssets>
<!--<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>-->
</PackageReference>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240227000" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26031-preview" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>
Steps to reproduce the bug
- Create a new project using:
- Modify the csproj file. Add <WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
- Modify the project to use .Net 8. Make sure to fix the RIDs.
- Update Windows App SDK and Build Tools in NPM.
- Install EF Core nuget references:
Expected behavior
No response
Screenshots
No response
NuGet package version
Windows App SDK 1.5.0: 1.5.240227000
Packaging type
Packaged (MSIX)
Windows version
Windows 11 version 22H2 (22621, 2022 Update)
IDE
Visual Studio 2022
Additional context
No response
@DJRM2021 This is a known incompatibility between EntityFramework and WindowsAppSDK, both of which publish WebView2.Core.dll. There are several workarounds discussed here: https://github.com/microsoft/WindowsAppSDK/issues/1856
Maybe we could make a configuration or option in the MSIX tooling to not include WebView2 if the app will not even use it?
Resolving this as a dup of #1856
Reopening, this for tracking WebView2 nuget reference factoring work. Retitled for clarity.
The primary issue tracking this is #https://github.com/microsoft/microsoft-ui-xaml/issues/5689 - closing as duplicate. Also, happy to report it is fixed in 1.6.240701003-experimental2.