Skip to content

Ensure that the dotnet-monitor tool package doesn't try to build for .NET 10 RID-specific tools #8552

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

Merged
merged 4 commits into from
Aug 23, 2025

Conversation

baronfel
Copy link
Member

@baronfel baronfel commented Aug 23, 2025

Continuing the fallout for .NET 10 RID-specific tools, we don't want to opt in to the new mode for this repo as of yet. We explicitly disable it for tool packaging only.

Before:

The RID-specific tool packages are created.
image

After:

The RID-specific tool packages are not created.
image

As part of this, because the dotnet-monitor package had some targets that were also adding explicit package files (which causes build errors due to duplicated files in the package), and this is no longer needed due to the change for tool packages to just use the output of Publish, I've made it so that dotnet publish of the dotnet-monitor project creates the same layout as the tool package, so you're getting increased consistency of execution-time experience.

I also compared the generated tool package to the existing published tool packages and the layouts were essentially identical.

@baronfel baronfel requested a review from a team as a code owner August 23, 2025 16:45
@@ -11,6 +11,13 @@
<Nullable>enable</Nullable>
<EnableConfigurationBindingGenerator>false</EnableConfigurationBindingGenerator>
<DisableCompileTimeOpenApiXmlGenerator>true</DisableCompileTimeOpenApiXmlGenerator>
<!-- This repo sets RuntimeIdentifiers globally in Directory.Build.props, but we explicitly don't want to use
RID-specific tools yet. So we need to clear the RuntimeIdentifiers here. -->
<RuntimeIdentifiers Condition="'$(_IsPacking)' == 'true'"></RuntimeIdentifiers>
Copy link
Member Author

Choose a reason for hiding this comment

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

I think we may need another condition here because the CI build doesn't run dotnet pack so _IsPacking won't be set. There may be some other ambient property available in the CI build that can be used here until the SDK gets a more clear knob.

Comment on lines -83 to -85
<Target Name="PublishProjectsBeforePack"
Condition="'$(SkipPublishProjects)' != 'true'">
<CallTarget Targets="PublishProjects" />
Copy link
Member Author

Choose a reason for hiding this comment

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

No longer needed because relevant projects are Published as part of Pack directly now.

Condition="'$(SkipPublishProjects)' != 'true'">
<CallTarget Targets="PublishProjects" />
</Target>
<ItemGroup Label="Computed Publish Assets">
Copy link
Member Author

Choose a reason for hiding this comment

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

We can declare all of these additional files ahead of time, and then hook them up at the right part of the Publishing lifecycle. This means we don't need to worry about Tool-specific paths, and can focus on just making the local publish experience correct. Then, if publish works, tools will also work.

Comment on lines +115 to +120
<Target Name="AddNativeAssetsToPublishLayout"
BeforeTargets="ComputeResolvedFilesToPublishList">
<ItemGroup>
<ResolvedFileToPublish Include="@(AdditionalRIDSpecificPublishFile->Exists());@(AdditionalRIDAgnosticPublishFile)">
<CopyFileToPublishDirectory>PreserveNewest</CopyFileToPublishDirectory>
</ResolvedFileToPublish>
Copy link
Member Author

Choose a reason for hiding this comment

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

Really easy to add all of the additional files to the publish output as a result!

@@ -91,7 +91,7 @@
<ProjectReference Include="..\..\Tools\dotnet-monitor\dotnet-monitor.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
<SetTargetFramework>TargetFramework=net10.0</SetTargetFramework>
<GlobalPropertiesToRemove>TargetFramework</GlobalPropertiesToRemove>
Copy link
Member Author

Choose a reason for hiding this comment

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

This was causing a race and double-builds of dotnet-monitor. Since this project isn't referencing the outputs of the project, we can completely remove the TFM of the current project from the set of properties that flow to the inner build of dotnet-monitor, which then makes MSBuild properly synchronize the builds/access of that project.

@wiktork wiktork merged commit dc35a51 into release/10.0 Aug 23, 2025
22 checks passed
@wiktork wiktork deleted the disable-rids-for-tool-packaging branch August 23, 2025 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants