Microsoft.Toolkit.Win32 icon indicating copy to clipboard operation
Microsoft.Toolkit.Win32 copied to clipboard

80080204: App manifest validation error during building XamlIsland apps

Open michalleptuch opened this issue 3 years ago • 19 comments

Describe the bug

I can't build my XamlIsland apps in Visual Studio 2019 v16.10 and higher. Even Visual Studio 2022 Preview doesn't handle it. Visual Studio 2019 v16.9.8 is the last tested and working version.

Error	APPX0501	Validation error. error 80080204: App manifest validation error: Line 66, Column 27, Reason: The field "*[local-name()='Extensions']/*[local-name()='Extension']/*[local-name()='InProcessServer']/*[local-name()='ActivatableClass']" with value "Microsoft.Toolkit.Win32.UI.XamlHost.XamlApplication" must only be declared once. A duplicate exists on Line 60, Column 27.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Clone this repo: https://github.com/michalleptuch/rounded-flyout
  2. Open in VS and try to build

Expected behavior

Correctly building of solution

Environment

Project .NET Version:
-  .NET Core 3.1

Packages:
- Microsoft.Toolkit.Win32.UI.XamlApplication (6.0.0-6.1.3)

Windows 10 Build Number:
- 18362-22000

App min and target version:
- 18362-22000

Device form factor:
- Desktop

Visual Studio 
- 2019 (version: 16.10.x) 
- 2022 Preview (version: 17.0)
- 2022

Additional context

I found similar issues that describe the same situations but solutions don't work for me:

  • https://stackoverflow.com/questions/64791579/app-manifest-validation-error-after-update-to-visual-studio-2019-16-8-0
  • https://developercommunity.visualstudio.com/t/Error-when-building-UWP-app-with-packagi/1258250#T-ND1273557

michalleptuch avatar Sep 15 '21 19:09 michalleptuch

Hello michalleptuch, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

ghost avatar Sep 15 '21 19:09 ghost

This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.

ghost avatar Nov 03 '21 02:11 ghost

This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.

ghost avatar Nov 18 '21 05:11 ghost

FYI @marb2000 @ocalvo

michael-hawker avatar Nov 30 '21 20:11 michael-hawker

The ModernFlyouts Team is also experiencing this issue. This is a major breaking bug that has had no solution for 4 months. @marb2000 @ocalvo @michael-hawker

Samuel12321 avatar Jan 09 '22 22:01 Samuel12321

I also experienced the same issue when I updated the VisualStudio2019. As a temporal solution I had to go back to the previous version and I can't upgrade until this bug won't be fixed.

atiyka avatar Jan 10 '22 12:01 atiyka

Has anyone filed a new issue with the Visual Studio team for this regression? If so, can they link to that issue here?

michael-hawker avatar Jan 10 '22 20:01 michael-hawker

Has been reported here https://developercommunity2.visualstudio.com/t/Visual-Studio-16100-breaks-support-for/1634426?q=microsoft.toolkit&ftype=problem&space=8&stateGroup=active&sort=newest

Samuel12321 avatar Jan 11 '22 20:01 Samuel12321

Has been reported here https://developercommunity2.visualstudio.com/t/Visual-Studio-16100-breaks-support-for/1634426?q=microsoft.toolkit&ftype=problem&space=8&stateGroup=active&sort=newest

Can everyone please upvote this issue so it can get fixed.

Samuel12321 avatar Jan 18 '22 23:01 Samuel12321

It seems that the toolkit msbuild code that detects if the Xaml Applicaton dll has been added already is now not detecting it and ends up adding 2 entries of the same dll.

ocalvo avatar Jan 24 '22 15:01 ocalvo

Please replace this section of your wap project as follows:

  <ItemGroup>
    <ProjectReference Include="..\RoundedFlyout.Uwp\RoundedFlyout.Uwp.csproj" />
    <ProjectReference Include="..\RoundedFlyout.Wpf\RoundedFlyout.Wpf.csproj" />
  </ItemGroup>
  <Target Name="_RemoveWinMDFromAppxManifest" BeforeTargets="_GenerateCurrentProjectAppxManifest">
    <ItemGroup>
      <_AppxWinmdFilesToHarvest Remove="@(_AppxWinmdFilesToHarvest)" />
    </ItemGroup>
  </Target>
  <Target Name="_StompSourceProjectForWapProject" BeforeTargets="_ConvertItems">
    <ItemGroup>
      <_TemporaryFilteredWapProjOutput Include="@(_FilteredNonWapProjProjectOutput)" />
      <_FilteredNonWapProjProjectOutput Remove="@(_TemporaryFilteredWapProjOutput)" />
      <_FilteredNonWapProjProjectOutput Include="@(_TemporaryFilteredWapProjOutput)">
        <SourceProject>
        </SourceProject>
      </_FilteredNonWapProjProjectOutput>
      <_DetailedPriXml Remove="@(_DetailedPriXml)" />
    </ItemGroup>
  </Target>

ocalvo avatar Jan 24 '22 17:01 ocalvo

Seems to work, Thanks @ocalvo. When should we expect this to be properly fixed?

Samuel12321 avatar Jan 25 '22 04:01 Samuel12321

@ocalvo Yes, it works for building, but during packaging app for the Store I get this error:

1>PRI175: 0x80073b0f - Processing Resources failed with error: Duplicate Entry.
1>PRI222: 0x80073b0f - Unspecified error occurred.

Branch: FixForVS

michalleptuch avatar Jan 25 '22 20:01 michalleptuch

Thank you @ocalvo, it works for me as well

atiyka avatar Feb 15 '22 14:02 atiyka

@ocalvo, after I added your suggestion to the project, I submitted the build to the Store, but the certification process did not start at all. After 4 days of waiting we received an email from the support: The submission has been cancelled due to an invalid package. Error details: Error: DirectWriteForwarder : Gatekeeper error GK0028 : GK0028 Assembly ‘DirectWriteForwarder’ is a mixed mode assembly containing managed and native code. Only pure managed assemblies are compatible with .NET Native. I reverted this change, created an app package with an older VS 2019 (16.9.1) and tried to submit to the store. Almost immediatelly started the certification process, so I think this workaround cause the issue.

Do you have any idea?

atiyka avatar Feb 22 '22 08:02 atiyka

@atiyka How did you create an app package? I stucked on this https://github.com/CommunityToolkit/Microsoft.Toolkit.Win32/issues/328#issuecomment-1021592542.

michalleptuch avatar Feb 28 '22 15:02 michalleptuch

Well, I just added the code above (except the first 4 lines) at the end of the .wapproj file in the UWP project before the closing </Project> tag. It created the app package without any issues for the packaging project in VS.

atiyka avatar Mar 01 '22 05:03 atiyka

This is a major breaking bug that has been a problem for 6 months now. Any eta on when we can expect an official solution / patch shipped? @marb2000 @ocalvo @michael-hawker

Samuel12321 avatar Mar 28 '22 09:03 Samuel12321

Also reported here: https://github.com/MicrosoftDocs/windows-dev-docs/issues/3544. This issue still exists in the latest version of Visual Studio 2022 unfortunately so I'm still stuck using Visual Studio 2019 16.9.8.

aquinn39 avatar Oct 23 '22 15:10 aquinn39