欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 财经 > 产业 > WinUI AOT 发布

WinUI AOT 发布

2025/3/14 8:35:44 来源:https://blog.csdn.net/vonlycn/article/details/143380742  浏览:    关键词:WinUI AOT 发布

1,修改项目配置

<PropertyGroup><OutputType>WinExe</OutputType><TargetFramework>net8.0-windows10.0.19041.0</TargetFramework><TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion><RootNamespace>App3</RootNamespace><ApplicationManifest>app.manifest</ApplicationManifest><Platforms>x86;x64;ARM64</Platforms><RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &gt;= 8">win-x86;win-x64;win-arm64</RuntimeIdentifiers><RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers><PublishProfile>win-$(Platform).pubxml</PublishProfile><UseWinUI>true</UseWinUI><EnableMsixTooling>true</EnableMsixTooling> <!-- 添加以下内容 --><!--版本号最后一组需改为 .38 --><WindowsSdkPackageVersion>10.0.19041.38</WindowsSdkPackageVersion><WindowsPackageType>None</WindowsPackageType><IsAotCompatible>true</IsAotCompatible><PublishAot>true</PublishAot><PlatformTarget>x64</PlatformTarget><CsWinRTAotOptimizerEnabled>true</CsWinRTAotOptimizerEnabled>
</PropertyGroup>

2,添加引用
Microsoft.Windows.CsWinRT
需要项目配置 WindowsPackageType = None

3,打包发布
打开项目所在位置执行以下命令
dotnet publish -r win-x64 -c Release

发布后如下
AOT发布结果
空项目最简运行如下路径这只能使用英文
AOT最简运行

最终最简运行成本5.52 MB ,
无运行库的环境会自动弹出运行库下载提示,根据提示下载安装即可.运行库体积59.3 MB
运行库体积

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词