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 #7845

Closed
mattleibow opened this issue Sep 6, 2022 · 3 comments
Closed

dotnet publish results in an error about duplicate files #7845

mattleibow opened this issue Sep 6, 2022 · 3 comments
Assignees
Labels
area-ProjectSystem bug Something isn't working needs-review 👀 team-Markup Issue for the Markup team

Comments

@mattleibow
Copy link

mattleibow commented Sep 6, 2022

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

mattleibow commented Sep 6, 2022

I can also reproduce this without a "maui" class library. In my attached repo, replace the contents of the plain ClassLibrary.csproj with:

msbuild.binlog.zip

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>net6.0</TargetFrameworks>
    <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
    <ImplicitUsings>enable</ImplicitUsings>
    <EnableMsixTooling>true</EnableMsixTooling>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup  Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
    <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.4" />
  </ItemGroup>

</Project>

@evelynwu-msft evelynwu-msft transferred this issue from microsoft/WindowsAppSDK Oct 18, 2022
@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Oct 18, 2022
@evelynwu-msft evelynwu-msft added bug Something isn't working area-ProjectSystem team-Markup Issue for the Markup team needs-review 👀 and removed needs-triage Issue needs to be triaged by the area owners labels Oct 18, 2022
@evelynwu-msft evelynwu-msft self-assigned this Oct 18, 2022
@mattleibow
Copy link
Author

I have updated the repository to leave MAUI out and just be a plain WinUI app.

@mattleibow
Copy link
Author

This issue was moved to microsoft/WindowsAppSDK#3337

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-ProjectSystem bug Something isn't working needs-review 👀 team-Markup Issue for the Markup team
Projects
None yet
Development

No branches or pull requests

2 participants