内容目录
Project publish parameters:
dotnet publish -c Release -r win-x64 -p:PublishProfile=FolderProfile --no-self-contained
dotnet publish -c Release -r win-x64 -p:PublishProfile=FolderProfile -p:PublishReadyToRun=true -p:PublishTrimmed=true --self-contained false
Enable trimming:
Disable reflection:
<IlcDisableReflection>true</IlcDisableReflection>
Add NuGet package reference:
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="7.0.0-*" />
</ItemGroup>
Other configurations:
<TrimMode>full</TrimMode>
<RunAOTCompilation>True</RunAOTCompilation>
<PublishTrimmed>true</PublishTrimmed>
<PublishAot>true</PublishAot>
<TrimmerRemoveSymbols>true</TrimmerRemoveSymbols>
<PublishReadyToRunEmitSymbols>false</PublishReadyToRunEmitSymbols>
<DebuggerSupport>false</DebuggerSupport>
<EnableUnsafeUTF7Encoding>true</EnableUnsafeUTF7Encoding>
<InvariantGlobalization>true</InvariantGlobalization>
<HttpActivityPropagationSupport>false</HttpActivityPropagationSupport>
<MetadataUpdaterSupport>true</MetadataUpdaterSupport>
<UseSystemResourceKeys>true</UseSystemResourceKeys>
<IlcDisableReflection >true</IlcDisableReflection>
PublishAot requires .NET 7 to use.
Simple configuration:
<!-- Publish related-->
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>false</SelfContained>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<!-- AOT related-->
<TrimMode>full</TrimMode>
<RunAOTCompilation>True</RunAOTCompilation>
<PublishTrimmed>true</PublishTrimmed>
<PublishAot>true</PublishAot>
<IlcDisableReflection>true</IlcDisableReflection>
文章评论