Skip to content

Conversation

@grendello
Copy link
Contributor

The $(LinkNativeDependsOn) property is used by the LinkNative target to list its dependency targets. Unfortunately, its value is unconditionally overwritten in Microsoft.NETCore.Native.targets, making it impossible for 3rd parties to add custom dependency targets to the LinkNative target.

Change the code to make sure that previous value of the property is preserved.

The `$(LinkNativeDependsOn)` property is used by the `LinkNative`
target to list its dependency targets. Unfortunately, its value
is unconditionally overwritten in `Microsoft.NETCore.Native.targets`,
making it impossible for 3rd parties to add custom dependency targets
to the `LinkNative` target.

Change the code to make sure that previous value of the property
is preserved.
Copilot AI review requested due to automatic review settings September 8, 2025 15:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an issue in the NativeAOT build integration where the $(LinkNativeDependsOn) property was being unconditionally overwritten, preventing third-party customizations from adding custom dependency targets to the LinkNative target.

  • Preserves existing values in $(LinkNativeDependsOn) while adding the required IlcCompile dependency

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

@teo-tsirpanis
Copy link
Contributor

Isn't it better to use BeforeTargets="LinkNative" to have a target run before LinkNative? My understanding is that the ***DependsOn properties is a relic of the past, before MSBuild added support for BeforeTargets and AfterTargets.

@MichalStrehovsky
Copy link
Member

Isn't it better to use BeforeTargets="LinkNative" to have a target run before LinkNative? My understanding is that the ***DependsOn properties is a relic of the past, before MSBuild added support for BeforeTargets and AfterTargets.

Looking at the rest of the SDK, it's more common not to provide overridability, but if this is useful, I don't see a problem with this.

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.

4 participants