Error APPX1101: [UWP] Payload contains two or more files with the same destination path: Microsoft.Web.WebView2.Core.dll

Ravi Khandale 5 Reputation points
2024-07-15T10:48:23.1366667+00:00
  1. Installed Visual Studio 2022 (on a clean/fresh Windows 11 installation) version 17.10.0
  2. Installed Microsoft.Identity.Client.Desktop Nuget package to open sign in within the window application.
  3. After that I'm getting "Found multiple publish output files with the same relative path: Microsoft.Web.WebView2.Core.dll" issue
  4. I did noticed whilst installing Microsoft.Identity.Client.Desktop that Microsoft.Web.WebView2 (version 1.0.864.35) got installed as well.
  5. But I'm guessing (from the Error) that there is another version of Microsoft.Web.WebView2 in MSIX Packaging in the Project folder.

What I tried:

  1. I tried adding the following property to my .csproj files
<PropertyGroup>
 <ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
</PropertyGroup>

But that gave me following error:

powershell
)
Severity  Code  Description  Project  File  Line  Suppression State Error (active)  APPX1101  Payload contains two or more files with the same destination path 'Microsoft.Web.WebView2.Core.dll'. Source files:  C:\Users\P63241\source\repos\BHE.GridSwift.App\Source\BHE.GridSwift.App.Client\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\MsixContent\Microsoft.Web.WebView2.Core.dll C:\Users\P63241\.nuget\packages\microsoft.web.webview2\1.0.864.35\lib\netcoreapp3.0\Microsoft.Web.WebView2.Core.dll
 
  1. I tried deleting the 'bin' and 'obj' folders from the Project folder and rebuilding solution but that gave me a bunch of other errors.
  2. I tried uninstalling (Start menu > right click on it, uninstall), and then cleaning the solution in Visual Studio before trying to deploy it again

At this point I tried everything and anything that I could find online - posting a question here is my last resort

How can I solve this version conflict?

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,625 questions
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,207 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,627 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 38,906 Reputation points Microsoft Vendor
    2024-07-17T02:09:56.7166667+00:00

    Hello,

    MAUI has a built-in browser, so you don't need to use this API to call it in MAUI. You can find instructions for this in DesktopExtensions.WithWindowsEmbeddedBrowserSupport Method of this API.

    This is not required for MAUI / WinUI applications. This is ignored on Mac and Linux.

    For how to use the embedded browser in MAUI, you can refer to the following document to enable it by setting a boolean value.

    Generally, it's recommended that you use the platform default, and this is typically the system browser. The system browser is better at remembering the users that have logged in before. To change this behavior, use WithUseEmbeddedWebView(Boolean)

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.