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

Error in Create App Packages for Microsoft Store from a .wapproj #3554

Closed
sis2004 opened this issue Nov 4, 2020 · 20 comments
Closed

Error in Create App Packages for Microsoft Store from a .wapproj #3554

sis2004 opened this issue Nov 4, 2020 · 20 comments
Labels
area-NugetPackage Issue with the nuget package developer experience (e.g. build error, missing files) no-issue-activity team-Controls Issue for the Controls team

Comments

@sis2004
Copy link

sis2004 commented Nov 4, 2020

Describe the bug
Creating app packages for MS store using a Packaging project with a UWP app fails with an error about Microsoft.UI.Xaml\Assets\NoiseAsset_256X256_PNG.png

Steps to reproduce the bug

Steps to reproduce the behavior:

  1. Create a new solution.
  2. Add a new UWP app
  3. Add a dependency on the Nuget package Microsoft.UI.Xaml.2.5.0-prerelease.201027002
  4. Add a new UWP project of type Windows Application Packaging Project called Package
  5. Add the UWP app project to the Package project, and make it an entry point
  6. Publish the Package project under a MS developer account using Create App Packages
  7. Select Microsoft Store option, and use a reserved app name.
  8. Set options to never generate an app bundle, select only x64 architecture, and click Create.
  9. Observe the following errors in the output console
1>Package -> C:\Users\MyUser\source\repos\App1\Package\AppPackages\Package_1.0.6.0_x64_Test\Package_1.0.6.0_x64.msix
1>C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64\MakeAppx.exe pack /l /h sha256 /f obj\x64\Release\upload.package.map.txt /o /p C:\Users\MyUser\source\repos\App1\Package\bin\x64\Release\Upload\Package_1.0.6.0_x64\Package_1.0.6.0_x64.msix  
1>You can't add both "C:\Users\MyUser\source\repos\App1\App2\bin\x64\Release\Microsoft.UI.Xaml\Assets\NoiseAsset_256X256_PNG.png" and "C:\Users\MyUser\.nuget\packages\microsoft.ui.xaml\2.5.0-prerelease.201027002\runtimes\win10-x64\native\Microsoft.UI.Xaml\Assets\NoiseAsset_256X256_PNG.png" to the output file as "Microsoft.UI.Xaml\Assets\NoiseAsset_256X256_PNG.png".
1>The mapping file can't be parsed.  The error occurs at line 185.
1>Package creation failed.
1>0x8007000b - An attempt was made to load a program with an incorrect format.

Expected behavior
VS should successfully create an .msixupload package for certification and submission.

NuGet package version:
[Microsoft.UI.Xaml.2.5.0-prerelease.201027002]

Windows app type:

UWP Win32
Yes
Windows 10 version Saw the problem?
Insider Build (xxxxx)
May 2020 Update (19041) Yes
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Xbox
Surface Hub
IoT
@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Nov 4, 2020
@sis2004
Copy link
Author

sis2004 commented Nov 4, 2020

I have installed the latest Windows SDK 10.0.19041.0, and have confirmed that the issue is still present.

1>Package -> C:\Users\MyUser\source\repos\App1\Package\AppPackages\Package_1.0.8.0_x64_Test\Package_1.0.8.0_x64.msix
1>C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\MakeAppx.exe pack /l /h sha256 /f obj\x64\Release\upload.package.map.txt /o /p C:\Users\MyUser\source\repos\App1\Package\bin\x64\Release\Upload\Package_1.0.8.0_x64\Package_1.0.8.0_x64.msix  
1>You can't add both "C:\Users\MyUser\source\repos\App1\App2\bin\x64\Release\Microsoft.UI.Xaml\Assets\NoiseAsset_256X256_PNG.png" and "C:\Users\MyUser\.nuget\packages\microsoft.ui.xaml\2.5.0-prerelease.201027002\runtimes\win10-x64\native\Microsoft.UI.Xaml\Assets\NoiseAsset_256X256_PNG.png" to the output file as "Microsoft.UI.Xaml\Assets\NoiseAsset_256X256_PNG.png".
1>The mapping file can't be parsed.  The error occurs at line 185.
1>Package creation failed.
1>0x8007000b - An attempt was made to load a program with an incorrect format.
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

Please let me know of any workarounds to allow publishing the package asap, as we need to deploy the app to our client.

@StephenLPeters
Copy link
Contributor

@sis2004 is this the same issue as #2859?

@StephenLPeters StephenLPeters added area-NugetPackage Issue with the nuget package developer experience (e.g. build error, missing files) needs-author-feedback Asked author to supply more information. team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Nov 5, 2020
@sis2004
Copy link
Author

sis2004 commented Nov 5, 2020

It does look similar, but I'm not sure if this is quite the same one. I tried the workaround by @stevenbrix, but it didn't work for the test project. I saw that he opened an internal issue for the VS team, but I don't have visibility into its status.

You should be able to reproduce it easily given the steps I provided. You don't need to download anything.

I'm not sure if this issue is specifically because of using a prerelease package, but we don't have an option to roll back to the released 2.4, since we use new functionality from that prerelease. We also cannot wait for the official 2.5 release, as we need to deliver the app now. So any working workaround would be greatly appreciated.

Please let me know if you need any additional information.

@ghost ghost added needs-triage Issue needs to be triaged by the area owners and removed needs-author-feedback Asked author to supply more information. labels Nov 5, 2020
@StephenLPeters
Copy link
Contributor

@stevenbrix Can you weigh in on this issue as well?

@StephenLPeters StephenLPeters removed the needs-triage Issue needs to be triaged by the area owners label Nov 6, 2020
@srdjanjovcic
Copy link
Member

I looked from VS point of view:

  • It reproduces easily with plain WAP project + UWP using UI.Xaml 2.5.0
  • It does not repro with 2.4.3
  • It is caused because that PNG file arrives to WAP payload both through CopyLocal mechanism (as an asset of NuGet package) and as a file referenced from Microsoft.UI.Xaml.pri, which is not part of runtime payload (it was not in 2.4.3)

@sis2004
Copy link
Author

sis2004 commented Nov 12, 2020

@StephenLPeters and @stevenbrix is there any update on this?

@sis2004
Copy link
Author

sis2004 commented Nov 19, 2020

Still haven't heard anything back. We are not able to deploy our app to our client because of this.
@ranjeshj can you follow up on the status of this issue?

@ranjeshj
Copy link
Contributor

@jevansaks @stevenbrix thoughts ?

@stevenbrix
Copy link
Contributor

Sorry for the delayed response, I'll take a look now

@stevenbrix
Copy link
Contributor

@srdjanjovcic thanks for your synopsis, I missed that.

Is there something wrong that the WinUI nuget is doing?

@stevenbrix
Copy link
Contributor

@kmahone or @llongley, can we embed the .png file in the .pri, so that it isn't referenced twice?

@kmahone
Copy link
Member

kmahone commented Nov 20, 2020

Since it does not repro with 2.4.3 but does repro in 2.5.0 - do we know what changed between these two versions? As far as I know we did not change anything with regards to how this asset is packaged between these two versions. Are we dealing with non-prerelease versions of the package in both cases?

@stevenbrix
Copy link
Contributor

@kmahone, ahh this is a release vs prerelease issue since their is no runtimes\win10-**\native directory in release packages

@kmahone
Copy link
Member

kmahone commented Nov 20, 2020

Which is the 'broken' case? The release or the prerelease package?

@stevenbrix
Copy link
Contributor

pre-release

@kmahone
Copy link
Member

kmahone commented Nov 20, 2020

It looks like the .pri file currently just points to the file instead of embedding it. I assume that embedding the file would also work.

@stevenbrix
Copy link
Contributor

stevenbrix commented Nov 21, 2020

Agreed, in the meantime @sis2004 can you try this workaround and let me know if this works for you:

<!-- This is a workaround for  https://github.com/microsoft/microsoft-ui-xaml/issues/3554 -->
  <Target Name="WorkaroundForIssue3554" BeforeTargets="_GenerateAppxUploadPackageFile" Returns="@(AppxUploadPackagePayload)">
    <ItemGroup>
      <!-- There is a duplicate of the noiseasset file. This happy little piece of code finds the duplicates-->
      <_FilteredAppxPackagePayload Include="@(AppxUploadPackagePayload)" Condition="'%(AppxUploadPackagePayload.TargetPath)'=='Microsoft.UI.Xaml\Assets\NoiseAsset_256X256_PNG.png'"/>
      
      <!-- This happy piece of code arbitrarily remove one of the duplicates based on some metadata that we can use to distinguish one of them. -->
      <_AppxPackagePayloadToRemove Include="@(_FilteredAppxPackagePayload)" Condition="'%(_FilteredAppxPackagePayload.ProjectName)'==''"/>

      <!-- Finally, remove one of the duplicates from the actual item group that's causing problems. This is the happiest of all the little code pieces. -->
      <AppxUploadPackagePayload Remove="@(_AppxPackagePayloadToRemove)"/>
    </ItemGroup>
  </Target>

@jevansaks
Copy link
Member

@kmahone Keith Mahoney FTE or @llongley Luke Longley FTE, can we embed the .png file in the .pri, so that it isn't referenced twice?

@stevenbrix if you can figure out how to do that, yes we can. When I looked at this a couple years ago there was no easy way (I think confirmed by @srdjanjovcic or @SvetBonev) to do this with MSBuild items the way the targets are authored. You can do it if you invoke makepri yourself but the way XBF files get embedded is special sauce.

@sis2004
Copy link
Author

sis2004 commented Nov 21, 2020

Thanks, @stevenbrix . The workaround works fine both on the test project and on our actual project.

I'll let you guys decide how to proceed with this issue, since ideally it should work with pre-release packages without any workarounds.

@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NugetPackage Issue with the nuget package developer experience (e.g. build error, missing files) no-issue-activity team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

7 participants