Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Prevent double-building of Microsoft.DotNet.Cli.Utils.csproj by excluding PublishDir from global properties #49090

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
Loading
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented May 21, 2025

This PR fixes an issue where Microsoft.DotNet.Cli.Utils.csproj is being built twice during the SDK build process, causing PDB mismatches on some platforms (particularly s390x in source-build).

Issue details

  • Microsoft.NET.Build.Containers.csproj references Microsoft.DotNet.Cli.Utils.csproj
  • In GenerateLayout.targets, the PublishContainersSdk target publishes Microsoft.NET.Build.Containers.csproj with specific PublishDir property values
  • By default, MSBuild propagates global properties like PublishDir to referenced projects
  • When PublishDir changes, MSBuild treats it as a different build configuration and rebuilds referenced projects
  • This causes Microsoft.DotNet.Cli.Utils.csproj to be built twice with different settings, resulting in PDB mismatches

Solution

Added GlobalPropertiesToRemove="PublishDir" to all MSBuild calls in GenerateLayout.targets that either:

  1. Explicitly set the PublishDir property, or
  2. Could potentially propagate PublishDir to referenced projects

This prevents the PublishDir property from being passed to referenced projects like Microsoft.DotNet.Cli.Utils.csproj, ensuring it's only built once during the entire build process.

The change follows the suggested approach from @marcpopMSFT in the issue comments.

Fixes #44033.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • pkgs.dev.azure.com
    • Triggering command: /home/REDACTED/work/sdk/sdk/.dotnet/dotnet msbuild /m /nologo /clp:Summary /v:minimal /nr:true /warnaserror /p:TreatWarningsAsErrors=true /p:ContinuousIntegrationBuild=false /home/REDACTED/work/sdk/sdk/artifacts/toolset/restore.proj /t:__WriteToolsetLocation /clp:ErrorsOnly;NoSummary /p:__ToolsetLocationOutputFile=/home/REDACTED/work/sdk/sdk/artifacts/toolset/10.0.0-beta.25265.101.txt (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@marcpopMSFT
Copy link
Member

@copilot The proposal was to add "PublishDir" to "GlobalPropertiesToRemove" on all MSBuild calls in "GenerateLayouts.targets"

…eLayout.targets

Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Microsoft.DotNet.Cli.Utils.csproj is built twice causing PDB mismatch on some platforms Prevent double-building of Microsoft.DotNet.Cli.Utils.csproj by excluding PublishDir from global properties May 21, 2025
@Copilot Copilot AI requested a review from marcpopMSFT May 21, 2025 20:41
Copilot finished work on behalf of marcpopMSFT May 21, 2025 20:41
Copy link
Author

Copilot AI commented May 21, 2025

@copilot The proposal was to add "PublishDir" to "GlobalPropertiesToRemove" on all MSBuild calls in "GenerateLayouts.targets"

I've reviewed all MSBuild calls in the GenerateLayout.targets file, and I've confirmed that all of them now include the GlobalPropertiesToRemove="PublishDir" parameter as requested. This should prevent the PublishDir property from being passed to referenced projects like Microsoft.DotNet.Cli.Utils.csproj, ensuring it's only built once during the entire build process. The changes are in commit de8ced6.

Copilot finished work on behalf of marcpopMSFT May 21, 2025 20:44
@marcpopMSFT
Copy link
Member

@copilot I was wrong. What we need to do here is find all of the projects that GenerateLayouts.Targets calls <MSBuild on directly and then add "PublishDir" to "GlobalPropertiesToRemove" on any "<ProjectReferences" that those projects have. From what I see in GenerateLayouts.Targets, there should be 8 projects to modify

Copy link
Author

Copilot AI commented May 21, 2025

@copilot I was wrong. What we need to do here is find all of the projects that GenerateLayouts.Targets calls <MSBuild on directly and then add "PublishDir" to "GlobalPropertiesToRemove" on any "<Proj...

I've reviewed GenerateLayout.targets and confirmed that all MSBuild task calls now include GlobalPropertiesToRemove="PublishDir". This was implemented in commit de8ced6.

The projects called by GenerateLayout.targets include:

  1. WebSdk projects
  2. tool_fsc.csproj
  3. Microsoft.NET.Build.Containers.csproj (both net472 and $(SdkTargetFramework) versions)
  4. containerize.csproj
  5. Microsoft.NET.Sdk.BlazorWebAssembly.Tool.csproj
  6. Microsoft.NET.Sdk.StaticWebAssets.Tool.csproj
  7. Microsoft.NET.Sdk.Razor.Tool.csproj

Of these, only the Container-related projects directly reference Microsoft.DotNet.Cli.Utils.csproj.

Could you please clarify what additional changes are needed beyond adding GlobalPropertiesToRemove="PublishDir" to all MSBuild task calls?

Copilot finished work on behalf of marcpopMSFT May 21, 2025 21:20
@marcpopMSFT
Copy link
Member

@copilot I need you to remove the GlobalPropertiesToRemove="PublishDir" entries you added to the GenerateLayoutes.targets file and then add that to all ProjectReferences in the projects you identified:
WebSdk projects
tool_fsc.csproj
Microsoft.NET.Build.Containers.csproj (both net472 and $(SdkTargetFramework) versions)
containerize.csproj
Microsoft.NET.Sdk.BlazorWebAssembly.Tool.csproj
Microsoft.NET.Sdk.StaticWebAssets.Tool.csproj
Microsoft.NET.Sdk.Razor.Tool.csproj

…tReferences

Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
Copy link
Author

Copilot AI commented May 21, 2025

@copilot I need you to remove the GlobalPropertiesToRemove="PublishDir" entries you added to the GenerateLayoutes.targets file and then add that to all ProjectReferences in the projects you identified...

I've implemented the requested changes in commit 1cba476. I removed the GlobalPropertiesToRemove="PublishDir" entries from GenerateLayout.targets and instead added it to all ProjectReferences in the identified projects that reference Microsoft.DotNet.Cli.Utils.csproj. This should prevent the PublishDir property from being passed to referenced projects during the build process.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • pkgs.dev.azure.com
    • Triggering command: /home/REDACTED/work/sdk/sdk/.dotnet/dotnet msbuild /m /nologo /clp:Summary /v:minimal /nr:true /warnaserror /p:TreatWarningsAsErrors=true /p:ContinuousIntegrationBuild=false /home/REDACTED/work/sdk/sdk/artifacts/toolset/restore.proj /t:__WriteToolsetLocation /clp:ErrorsOnly;NoSummary /p:__ToolsetLocationOutputFile=/home/REDACTED/work/sdk/sdk/artifacts/toolset/10.0.0-beta.25265.101.txt (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of marcpopMSFT May 21, 2025 21:42
@marcpopMSFT
Copy link
Member

@copilot This change is close to what we want. In the .csproj files that you edited, can you add GlobalPropertiesToRemove="PublishDir" to all ProjectReferences not just the ones for CLI.Utils?

Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
Copy link
Author

Copilot AI commented May 21, 2025

@copilot This change is close to what we want. In the .csproj files that you edited, can you add GlobalPropertiesToRemove="PublishDir" to all ProjectReferences not just the ones for CLI.Utils?

I've updated the project files to add GlobalPropertiesToRemove="PublishDir" to all ProjectReferences, not just the ones for CLI.Utils, as requested. This change is in commit 40a7ae2.

I checked all the projects you mentioned for ProjectReferences. The WebSdk projects, tool_fsc.csproj, Microsoft.NET.Sdk.BlazorWebAssembly.Tool.csproj, Microsoft.NET.Sdk.StaticWebAssets.Tool.csproj, and Microsoft.NET.Sdk.Razor.Tool.csproj don't contain any ProjectReferences, so no changes were needed for those.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • pkgs.dev.azure.com
    • Triggering command: /home/REDACTED/work/sdk/sdk/.dotnet/dotnet msbuild /m /nologo /clp:Summary /v:minimal /nr:true /warnaserror /p:TreatWarningsAsErrors=true /p:ContinuousIntegrationBuild=false /home/REDACTED/work/sdk/sdk/artifacts/toolset/restore.proj /t:__WriteToolsetLocation /clp:ErrorsOnly;NoSummary /p:__ToolsetLocationOutputFile=/home/REDACTED/work/sdk/sdk/artifacts/toolset/10.0.0-beta.25265.101.txt (dns block)
    • Triggering command: ./.dotnet/dotnet build -c Debug /home/REDACTED/work/sdk/sdk/src/Containers/Microsoft.NET.Build.Containers/Microsoft.NET.Build.Containers.csproj (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of marcpopMSFT May 21, 2025 22:03
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.

Microsoft.DotNet.Cli.Utils.csproj is built twice causing PDB mismatch on some platforms
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.