이번 버전에서 가장 특이한 사항은 무려 Native AOT를 지원한다는 것입니다.
먼저 WinUI 3 프로젝트를 만드시고,
프로젝트 파일을 다음과 같이 수정합니다.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.18362.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<WindowsSdkPackageVersion>10.0.18362.35-preview</WindowsSdkPackageVersion>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x64</Platforms>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<UseWinUI>true</UseWinUI>
<EnableMsixTooling>true</EnableMsixTooling>
<WindowsPackageType>None</WindowsPackageType>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<PublishAot>true</PublishAot>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Bluehill.Imports" Version="1.0.4" />
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.1.0-prerelease.240602.1" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240531000-experimental1" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>
</Project>
이제 publish 하면…
dotnet publish -c Debug -p:Platform=x64
CsWinRT 패키지 때문인지 원래는 안나왔던 오류가 나옵니다.
따라서 타겟하시는 윈도우 SDK를 설치하셔야 합니다.
다시 한번 publish해 보면…
이렇게 9 MB짜리 파일이 생성됩니다.
실행도 바로바로 정상적으로 됩니다.
아쉬운 점은 WindowsAppSDKSelfContained의 dll들은 포함이 되지 않는다는 것입니다.






