Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet publish results in an error about duplicate files #3337

Open
mattleibow opened this issue Jan 13, 2023 · 4 comments
Open

dotnet publish results in an error about duplicate files #3337

mattleibow opened this issue Jan 13, 2023 · 4 comments
Labels
area-DeveloperTools Issues related to authoring (source and IDL), debugging, HotReload, LiveVisualTree, VS integration feature proposal maui-7.x Bugs targeted for maui-7.x

Comments

@mattleibow
Copy link

mattleibow commented Jan 13, 2023

Issue moved from microsoft/microsoft-ui-xaml#7845

Describe the bug

Based on this issue: dotnet/maui#9879

Passing a -r win10-x64 to a app .csproj tries to load both a "neutral" and a "RID-specific" dll/pdb into the app:

dotnet publish MyApp.csproj -c Release -f net6.0-windows10.0.19041.0 -r win10-x64

Steps to reproduce the bug

  1. Clone https://github.com/mattleibow/Maui-Issue-9879
  2. Execute the publish command:
    dotnet publish -r win10-x64 -f net6.0-windows10.0.19041.0 /bl .\WinUIApp\WinUIApp.csproj
    
  3. Observe error:
    Failure: msbuild.binlog.zip
    error APPX1101: Payload contains two or more files with the same destination path 'MauiClassLibrary.pdb'. Source files:
    error APPX1101: ...\MauiClassLibrary\bin\Release\net6.0-windows10.0.19041.0\MauiClassLibrary.pdb 
    error APPX1101: ...\MauiClassLibrary\bin\Release\net6.0-windows10.0.19041.0\win10-x64\MauiClassLibrary.pdb 
    
  4. Run build again with custom RuntimeIdentifierOverride property set:
     dotnet publish  .\WinUIApp\WinUIApp.csproj -c Release -f net6.0-windows10.0.19041.0 /p:RuntimeIdentifierOverride=win10-x86
    
  5. Observe success
    Success: msbuild.binlog.zip

Expected behavior

Passing the RID should only apply the the app project, and the class library references should just be non-RID.

Screenshots

No response

NuGet package version

1.1.4

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 21H2 (22000)

IDE

Other

Additional context

I was able to make a workaround:

Add this to the bottom of the app .csproj:

<PropertyGroup Condition="'$(RuntimeIdentifierOverride)' != ''">
	<RuntimeIdentifier>$(RuntimeIdentifierOverride)</RuntimeIdentifier>
</PropertyGroup>

Then when executing, use the new property instead of the RID:

dotnet publish  .\WinUIApp\WinUIApp.csproj -c Release -f net6.0-windows10.0.19041.0 /p:RuntimeIdentifierOverride=win10-x86
@mattleibow
Copy link
Author

It also seems that an error occurrs when PublishTrimmed set to true:

error APPX1101: Payload contains two or more files with the same destination path 'MauiApp1.pdb'. Source files:
error APPX1101: C:\Users\lopi2\source\repos\MauiApp1\MauiApp1\obj\Release\net7.0-windows10.0.19041.0\win10-x64\linked\MauiApp1.pdb
error APPX1101: C:\Users\lopi2\source\repos\MauiApp1\MauiApp1\bin\Release\net7.0-windows10.0.19041.0\win10-x64\MauiApp1.pdb

@HakamFostok
Copy link

Any workaround for this? I tried making PublishTrimmed set to false but nothing solved the problem
Is this going to be solved when .NET 8 is released?

@sigmarsson
Copy link

Has no effect.

  <PropertyGroup>
    <PublishTrimmed>false</PublishTrimmed>
  </PropertyGroup>

@mattleibow
Copy link
Author

Related to #4008

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-DeveloperTools Issues related to authoring (source and IDL), debugging, HotReload, LiveVisualTree, VS integration feature proposal maui-7.x Bugs targeted for maui-7.x
Projects
None yet
Development

No branches or pull requests

6 participants