dotnet / runtimelab

This repo is for experimentation and exploring new ideas that may or may not make it into the main dotnet/runtime repo.
MIT License
1.43k stars 201 forks source link

NativeAOT breaking change announcements #1241

Open MichalStrehovsky opened 3 years ago

MichalStrehovsky commented 3 years ago

This issue will be a running list of potentially breaking changes in NativeAOT. If you use NativeAOT in your project, make sure to click the "Subscribe" button on this issue.

MichalStrehovsky commented 3 years ago

The AppContextSwitchOverrides ItemGroup in project files was replaced with the officially documented RuntimeHostConfigurationOption. Migration path is this:

old value: <AppContextSwitchOverrides Include="Switch.System.Reflection.Disabled.DoNotThrowForNames" /> new value: <RuntimeHostConfigurationOption Include="Switch.System.Reflection.Disabled.DoNotThrowForNames" Value="true" />.

https://github.com/dotnet/runtimelab/pull/1227

MichalStrehovsky commented 3 years ago

The ILCompiler package version was bumped to 7.0. If you're using one of 6.0 wildcards to reference the ILCompiler NuGet package, please switch to 7.0 like outlined in https://github.com/dotnet/runtimelab/pull/1452 to keep getting the latest.

MichalStrehovsky commented 3 years ago

In the past, setting <TrimMode>link</TrimMode> in the csproj would trim the entire app. This was a shortcut because .NET 5 there was a no convenient way to express "I want to trim the whole app".

As of #1596 we now align with the documented trimming settings.

To trim the entire app you now need to:

On .NET 6, set the <TrimmerDefaultAction>link</TrimmerDefaultAction> property.

On .NET 5 you need to write a custom target (this also works on .NET 6, but why would you do this to yourself?):

  <Target Name="ConfigureTrimming"
          BeforeTargets="PrepareForILLink">
    <ItemGroup>
      <ManagedAssemblyToLink>
        <TrimMode>link</TrimMode>
      </ManagedAssemblyToLink>
    </ItemGroup>
  </Target>
MichalStrehovsky commented 2 years ago

We’ve moved the NativeAOT project out of the dotnet/runtimelab repo to the dotnet/runtime repo. As part of the move, the NuGet feed changed from the dotnet-experimental one to the dotnet7 one.

To keep getting ILCompiler package updates, please update your NuGet feed from (old feed):

https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json

To (new feed):

https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json

The latest package version at the time of this announcement is 7.0.0-preview.2.22081.5.

We’ve also bumped the minimum required .NET SDK version to 6.0.