-
-
Notifications
You must be signed in to change notification settings - Fork 970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix isnativeaot definition #2561
base: master
Are you sure you want to change the base?
Conversation
There is no public API to detect whether the app has been published with NativeAOT is a collection of individual behaviors (single-file, no dynamic code, AOT pre-compilation, trimming, IL trimmed from the final binary, ...). We recommend that libraries check for these individual behaviors. |
Maybe just add the |
There are no plans to add one. We have capability checks: for example, when accessing If one is just curious if PublishAot was in the project for informational purposes like it seems here (not for <ItemGroup>
<AssemblyMetadata Include="BuildProperties.PublishAot" Value="$(PublishAot)" />
</ItemGroup> to the project file, and using: foreach (var a in Assembly.GetEntryAssembly().GetCustomAttributes<AssemblyMetadataAttribute>())
if (a.Key == "BuildProperties.PublishAot")
Console.WriteLine($"PublishAot: '{a.Value}'"); to check for it. I'd remove the |
I meant the If I don't think we can do that Anyways, @kasperk81 hasn't even described the problem that this code produced. |
Assembly.Location is true for PublishSingleFile as well |
Right, and it looks like we incorrectly check that for |
current detection fails to differentiate between PublishSingleFile and PublishAot because they both return null from Assembly.Location.
@adamsitnik @jkotas is there any existing app model API available to make this detection less fragile?