WinUi3相关


WinUi3独立打包

1、在项目文件右键编辑项目文件

2、在项目文件中找到 PropertyGroup 标签,在标签中添加

<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>

详细信息如下

<PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
    <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
    <RootNamespace>WinUi3Test01</RootNamespace>
    <ApplicationManifest>app.manifest</ApplicationManifest>
    <Platforms>x86;x64;ARM64</Platforms>
    <RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
    <PublishProfile>win10-$(Platform).pubxml</PublishProfile>
    <UseWinUI>true</UseWinUI>
    <EnableMsixTooling>true</EnableMsixTooling>
    <GenerateAppInstallerFile>True</GenerateAppInstallerFile>
    <AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
    <AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
    <GenerateTestArtifacts>True</GenerateTestArtifacts>
    <AppxBundle>Never</AppxBundle>
    <AppInstallerUri>C:\test</AppInstallerUri>
    <HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
    <AppxPackageSigningEnabled>False</AppxPackageSigningEnabled>
    <PackageCertificateKeyFile>WinUi3Test01_TemporaryKey.pfx</PackageCertificateKeyFile>
    <AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>

	<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>

  </PropertyGroup>

3、到文件底部,在 Project 中添加下面的标签

<Target Name="_RemoveFrameworkReferences" BeforeTargets="_ConvertItems;_CalculateInputsForGenerateCurrentProjectAppxManifest">
    <ItemGroup>
      <FrameworkSdkReference Remove="@(FrameworkSdkReference)" Condition="$([System.String]::Copy('%(FrameworkSdkReference.SDKName)').StartsWith('Microsoft.WindowsAppRuntime.'))" />
    </ItemGroup>
  </Target>

文章作者: 花舞流觞
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 花舞流觞 !
  目录