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

WinUI3 AOT publishing package generated error #5128

Open
BlameTwo opened this issue Feb 9, 2025 · 4 comments
Open

WinUI3 AOT publishing package generated error #5128

BlameTwo opened this issue Feb 9, 2025 · 4 comments

Comments

@BlameTwo
Copy link

BlameTwo commented Feb 9, 2025

Describe the bug

When I tried to publish the project using AOT, he got the following error

Image

This is my project file structure:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
    <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
    <RootNamespace>WutheringWavesTool</RootNamespace>
    <ApplicationManifest>app.manifest</ApplicationManifest>
    <Platforms>x86;x64</Platforms>
	  <LangVersion>preview</LangVersion>
	  <RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &gt;= 8">win-x64</RuntimeIdentifier>
	  <RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x64</RuntimeIdentifier>
	  <PublishAot>true</PublishAot>
    <RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
	  <JsonSerializerIsReflectionEnabledByDefault>false</JsonSerializerIsReflectionEnabledByDefault>
    <UseWinUI>true</UseWinUI>
	  <PublishAot>true</PublishAot>
    <EnableMsixTooling>true</EnableMsixTooling>
	  <WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
    <Nullable>enable</Nullable>
  </PropertyGroup>
  <ItemGroup>
    <None Remove="Assets\appLogo.ico" />
    <None Remove="Assets\Background\background.png" />
    <None Remove="Assets\Background\background2.png" />
    <None Remove="Assets\Background\kelaita.png" />
    <None Remove="Assets\Background\kelaita2.png" />
    <None Remove="Assets\backup.jpg" />
    <None Remove="Assets\clickSound.wav" />
    <None Remove="Assets\Font.ttf" />
    <None Remove="Assets\GameIcons\bilibili.ico" />
    <None Remove="Assets\GameIcons\global.ico" />
    <None Remove="Assets\geet.html" />
    <None Remove="Assets\Images\shouanren2.png" />
    <None Remove="Assets\logo.ico" />
    <None Remove="Assets\mcLogo.png" />
    <None Remove="Controls\ImageGroupAnimation.xaml" />
    <None Remove="Controls\PopupMessage.xaml" />
    <None Remove="Controls\Styles\Button.xaml" />
    <None Remove="Controls\Styles\ImageEx.xaml" />
    <None Remove="Controls\Styles\ProgressBar.xaml" />
    <None Remove="Controls\Styles\SpiltButtonStyle.xaml" />
    <None Remove="Controls\Styles\TitleBar.xaml" />
    <None Remove="Pages\CommunityPage.xaml" />
    <None Remove="Pages\Communitys\GamerChallengePage.xaml" />
    <None Remove="Pages\Communitys\GamerDockPage.xaml" />
    <None Remove="Pages\Communitys\GamerExploreIndexPage.xaml" />
    <None Remove="Pages\Communitys\GamerSignPage.xaml" />
    <None Remove="Pages\Communitys\GamerSkinPage.xaml" />
    <None Remove="Pages\Communitys\GamerTowerPage.xaml" />
    <None Remove="Pages\Communitys\Windows\GamerRoilDetilyPage.xaml" />
    <None Remove="Pages\Dialogs\BindGameDataDialog.xaml" />
    <None Remove="Pages\Dialogs\InputRecordCardDialog.xaml" />
    <None Remove="Pages\Dialogs\LoginDialog.xaml" />
    <None Remove="Pages\GamePages\BilibiliGamePage.xaml" />
    <None Remove="Pages\GamePages\GlobalGamePage.xaml" />
    <None Remove="Pages\GamePages\MainGamePage.xaml" />
    <None Remove="Pages\Record\PlayerRecordPage.xaml" />
    <None Remove="Pages\Record\RecordItemPage.xaml" />
    <None Remove="Pages\SettingPage.xaml" />
    <None Remove="Pages\ShellPage.xaml" />
    <None Remove="Pages\TestPage.xaml" />
    <None Remove="WindowModels\GetgeetWindow.xaml" />
  </ItemGroup>
	<ItemGroup>
		<RdXmlFile Include="rd.xml" />
	</ItemGroup>
	<ItemGroup>
		<Content Include="rd.xml">
			<CopyToOutputDirectory>Always</CopyToOutputDirectory>
		</Content>
	</ItemGroup>
	<ItemGroup>
    <Content Include="Assets\SplashScreen.scale-200.png" />
    <Content Include="Assets\LockScreenLogo.scale-200.png" />
    <Content Include="Assets\Square150x150Logo.scale-200.png" />
    <Content Include="Assets\Square44x44Logo.scale-200.png" />
    <Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
    <Content Include="Assets\Wide310x150Logo.scale-200.png" />
  </ItemGroup>

  <ItemGroup>
    <Manifest Include="$(ApplicationManifest)" />
  </ItemGroup>

  <!--
    Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging
    Tools extension to be activated for this project even if the Windows App SDK Nuget
    package has not yet been restored.
  -->
  <ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
    <ProjectCapability Include="Msix" />
  </ItemGroup>
  <ItemGroup>
	  <PackageReference Include="CommunityToolkit.WinUI.Animations" Version="8.2.250129-preview2" />
	  <PackageReference Include="CommunityToolkit.WinUI.Behaviors" Version="8.2.250129-preview2" />
	  <PackageReference Include="CommunityToolkit.WinUI.Extensions" Version="8.2.250129-preview2" />
	  <PackageReference Include="H.NotifyIcon.WinUI" Version="2.2.0" />
	  <PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0" />
	  <PackageReference Include="Microsoft.Graphics.Win2D" Version="1.3.1" />
	  <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
	  <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
	  <PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2957.106" />
	  <PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.2.0" />
	  <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
	  <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.250108002" />
	  <PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="3.0.0" />
	  <PackageReference Include="WinUICommunity.Components" Version="7.1.0" />
	  <PackageReference Include="WinUICommunity.Win2D" Version="7.1.0" />
	  <PackageReference Include="WinUIEx" Version="2.5.1" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\Waves.Api\Waves.Api.csproj" />
    <ProjectReference Include="..\Waves.Core\Waves.Core.csproj" />
  </ItemGroup>
  <ItemGroup>
    <Content Update="Assets\applogo.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\Font.ttf">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <Content Update="Assets\appLogo.ico">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\backup.jpg">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\clickSound.wav">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\geet.html">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\Icons\dataIcon.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\Icons\Icon1.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\Icons\Icon2.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\Icons\Icon3.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\Icons\Icon4.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\Icons\Icon5.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\Icons\Icon6.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\Images\changli.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\Images\Error.gif">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\Images\loading.gif">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\Images\shouanren2.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\kLogo.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\logo.ico">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\mcLogo.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <Content Update="Assets\GameIcons\bilibili.ico">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\GameIcons\global.ico">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <Content Update="Assets\Background\background.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\Background\background2.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\Background\kelaita.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Update="Assets\Background\kelaita2.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Pages\TestPage.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Controls\Styles\TileGallery.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Pages\Record\RecordItemPage.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Pages\Dialogs\InputRecordCardDialog.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Pages\Communitys\GamerSkinPage.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Pages\Communitys\GamerTowerPage.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Pages\Communitys\GamerExploreIndexPage.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Pages\Communitys\GamerChallengePage.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Controls\Styles\ImageEx.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Pages\Communitys\GamerDockPage.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Pages\Dialogs\BindGameDataDialog.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Pages\Communitys\GamerRoilsPage.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Pages\CommunityPage.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Controls\PopupMessage.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Controls\Styles\ProgressBar.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Pages\SettingPage.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Controls\Styles\SpiltButtonStyle.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Pages\GamePages\GlobalGamePage.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Pages\GamePages\BilibiliGamePage.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Controls\ImageGroupAnimation.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Controls\Styles\Button.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Controls\Styles\TitleBar.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Pages\ShellPage.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Pages\GamePages\MainGamePage.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="WindowModels\GetGeetWindow.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Pages\Dialogs\LoginDialog.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Pages\Communitys\GamerSignPage.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Pages\Communitys\Windows\GamerRoilDetilyPage.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <Page Update="Pages\Record\PlayerRecordPage.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>

  <!--
    Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution
    Explorer "Package and Publish" context menu entry to be enabled for this project even if
    the Windows App SDK Nuget package has not yet been restored.
  -->
  <PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
    <HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
  </PropertyGroup>

  <!-- Publish Properties -->
  <PropertyGroup>
    <PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
    <PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
    <PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
    <PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
    <GenerateAppInstallerFile>False</GenerateAppInstallerFile>
    <AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
    <PackageCertificateKeyFile>WutheringWavesTool_TemporaryKey.pfx</PackageCertificateKeyFile>
    <AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
    <AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
    <AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
    <GenerateTestArtifacts>True</GenerateTestArtifacts>
    <AppxBundle>Always</AppxBundle>
    <HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
    <AppxBundlePlatforms>x64</AppxBundlePlatforms>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
  </PropertyGroup>
</Project>

Steps to reproduce the bug

I just rolled back the version of VS, from preview to the official version, and this problem arose

Expected behavior

He should publish successfully

Screenshots

NuGet package version

Windows App SDK 1.6.3: 1.6.250108002

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 24H2 (22621, October 2024 Update)

IDE

Visual Studio 2022-preview

Additional context

No response

@BlameTwo
Copy link
Author

BlameTwo commented Feb 9, 2025

Also here is my VS workload configuration:

Image

Image

@riverar
Copy link
Contributor

riverar commented Feb 10, 2025

Can you create/provide a project that reproduces the issue? A link to a repository or a ZIP works.

@BlameTwo
Copy link
Author

I tried to create a Window virtual machine for AOT generation and it worked fine, which is very strange.

Other suspected points:

Can not create.NET 9 Uwp application, will prompt can not find the SDK, ordinary Uwp program also can not, I know the SDK is wrong, but no matter how I reinstall it does not work, in addition to reinstall the system, I do not know how to fix this error, I can only send packages on the virtual machine now

@BlameTwo
Copy link
Author

@riverar This is my store address: https://github.com/BlameTwo/WutheringWavesTool.git
His AOT on the virtual machine runs well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants