McTwitch
McTwitch

Reputation: 51

How do I remove "multiple publish output files with the same relative path" in a dotnet core WinUI3 application?

First time poster, so please let me know if I forgot anything.

I've got a dotnet project I've been working on using WinUI3 in Visual Studio 2022. More or less it grabs some reports from Azure using Microsoft Graph.

When trying to package the application, for use on a different machine, I get the following error:

error NETSDK1152: Found multiple publish output files with the same relative path: C:\Users\McTwitch\source\repos\Heimdall\obj\x64\Release\net6.0-windows10.0.19041.0\win10-x64\MsixContent\Microsoft.Web.WebView2.Core.dll, obj\x64\Release\net6.0-windows10.0.19041.0\win10-x64\R2R\Microsoft.Web.WebView2.Core.dll.

I've added

<PropertyGroup>
 <ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
</PropertyGroup>

to my .csproj file, and that gives me a different error:

Severity    Code    Description Project Path    File    Line    Source  Suppression State
Error   APPX1101    Payload contains two or more files with the same destination path 'Microsoft.Web.WebView2.Core.dll'. Source files: 
C:\Users\McTwitch\source\repos\Heimdall\obj\x64\Release\net6.0-windows10.0.19041.0\win10-x64\MsixContent\Microsoft.Web.WebView2.Core.dll
C:\Users\McTwitch\source\repos\Heimdall\obj\x64\Release\net6.0-windows10.0.19041.0\win10-x64\R2R\Microsoft.Web.WebView2.Core.dll    SIEMGUI C:\Users\McTwitch\.nuget\packages\microsoft.windowsappsdk\1.2.221109.1\buildTransitive  C:\Users\McTwitch\.nuget\packages\microsoft.windowsappsdk\1.2.221109.1\buildTransitive\Microsoft.Build.Msix.Packaging.targets   1504    Build   

I've also checked Tools>NuGet Package Manager > Manage NuGet Packages for this Solution, but there aren't any entries under "Consolidate".

There was one post (Publish error: Found multiple publish output files with the same relative path) that mentioned adding some lines to the common.props file, but I haven't been able to locate the file, which is a tad frustrating.

Any and all help is appreciated, and I'll try to reply as quickly as I can to any additional questions or requests for information.

Upvotes: 3

Views: 5117

Answers (1)

McTwitch
McTwitch

Reputation: 51

I can't say for certain what made it work, but eventually I was able to publish/deploy the app by making sure it was uninstalled (Start menu > right click on it, uninstall), and then cleaning the solution in Visual Studio before trying to deploy it again. That seems to have fixed the issue!

Upvotes: 2

Related Questions