Skip to content

Publish support in SDK for Native Aot Application#24693

Merged
LakshanF merged 18 commits intodotnet:mainfrom
LakshanF:PublishAotSupport
Apr 22, 2022
Merged

Publish support in SDK for Native Aot Application#24693
LakshanF merged 18 commits intodotnet:mainfrom
LakshanF:PublishAotSupport

Conversation

@LakshanF
Copy link
Copy Markdown
Contributor

@LakshanF LakshanF commented Apr 4, 2022

Add support to publish NativeAot applications via the SDK with 3 parts:

  1. Integrate package that contain mostly SDK assets, Microsoft.DotNet.ILCompiler, to the SDK via bundling. This is similar to how Microsoft.NET.ILLink.Tasks package is leveraged.
  • Add details to Version.Details.xml, Versions.props, and BundledSdks.targets
  • Requires the Microsoft.DotNet.ILCompiler package to contain a sdk.targets in a SDK directory. This needs to be added in the runtime repo where this package is built
  1. Dynamically download the package, Runtime.**RID**.Microsoft.DotNet.ILCompiler which contains tools, runtime and Framework libraries.
  1. Add a test scenario to, GivenThatWeWantToPublishAnAotApp.cs, to validate that PublishAot produces a native application. Linux support via running the tests in a container as well as additional test scenarios for native libraries (static and shared) have been added in subsequent PRs

Assumes that there is a darc channel to get the required package between runtime repo and sdk

Comment thread eng/Version.Details.xml Outdated
Comment thread src/Layout/redist/targets/BundledSdks.targets Outdated
Comment thread src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs
Comment thread src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ILCompiler.targets Outdated
Comment thread src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ILCompiler.targets Outdated
Comment thread src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunAnAotApp.cs Outdated
@tlakollo
Copy link
Copy Markdown
Contributor

Also, we are missing something that enables the analyzer (EnableAotAnalyzer) if PublishAot is set to true

Copy link
Copy Markdown
Member

@agocke agocke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized when looking through darc -- we already have a subscription here for the other runtime stuff. No need to set up anything new

Comment thread src/Layout/toolset-tasks/OverrideAndCreateBundledNETCoreAppPackageVersion.cs Outdated
Copy link
Copy Markdown
Member

@agocke agocke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM aside from comment

Comment thread src/Layout/toolset-tasks/OverrideAndCreateBundledNETCoreAppPackageVersion.cs Outdated
@LakshanF LakshanF merged commit 7a55213 into dotnet:main Apr 22, 2022
@LakshanF LakshanF deleted the PublishAotSupport branch April 22, 2022 13:10
Comment on lines +149 to +156
try
{
var metadataReader = peReader.GetMetadataReader();
}catch(InvalidOperationException)
{
returnValue = true;
}
catch(Exception){}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: peReader.HasMetadata is the property to use here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants