Skip to content

[main] Source code updates from dotnet/msbuild#5183

Merged
dotnet-maestro[bot] merged 16 commits intomainfrom
darc-main-2d50c190-03d7-4685-ace2-834d6744fa74
Mar 9, 2026
Merged

[main] Source code updates from dotnet/msbuild#5183
dotnet-maestro[bot] merged 16 commits intomainfrom
darc-main-2d50c190-03d7-4685-ace2-834d6744fa74

Conversation

@dotnet-maestro
Copy link
Copy Markdown
Contributor

@dotnet-maestro dotnet-maestro bot commented Mar 3, 2026

Note

This is a codeflow update. It may contain both source code changes from
the source repo
as well as dependency updates. Learn more here.

This pull request brings the following source code changes

From https://github.com/dotnet/msbuild

Diff the source with this PR branch
darc vmr diff --name-only https://github.com/dotnet/msbuild:6500dd278aed2749db445942790934e3c0d8c729..https://github.com/dotnet/dotnet:darc-main-2d50c190-03d7-4685-ace2-834d6744fa74

@dotnet-maestro
Copy link
Copy Markdown
Contributor Author

dotnet-maestro bot commented Mar 3, 2026

@dotnet-policy-service dotnet-policy-service bot requested a review from a team March 3, 2026 02:10
@dotnet-maestro
Copy link
Copy Markdown
Contributor Author

dotnet-maestro bot commented Mar 4, 2026

Adds SDK layout and installer support for the MSBuild apphost,
following the same pattern as the Roslyn apphost changes (#3180).

Changes:
- Define _MSBuildAppHost item in Directory.Build.props
- Add CreateMSBuildAppHost target in GenerateLayout.targets
  (CreateAppHost, COM .tlb copy on Windows, codesign on macOS)
- Add MSBuild apphost chmod in ChmodPublishDir and Crossgen targets
- Add macOS signing config for MSBuild apphost in Signing.props
- Add msbuild-entitlements.plist for macOS codesigning
- Add Microsoft.Build.Framework.tlb binary for Windows COM support
- Allow .tlb in allowed-vmr-binaries.txt

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@YuliiaKovalova YuliiaKovalova requested review from a team as code owners March 4, 2026 09:52
@dotnet-policy-service dotnet-policy-service bot requested a review from a team March 4, 2026 09:53
@ViktorHofer
Copy link
Copy Markdown
Member

ViktorHofer commented Mar 4, 2026

The MSBuild apphost is not needed for source-build scenarios

@YuliiaKovalova I'd like to hear more about this. Not creating the apphost when building the SDK from source creates a difference between the MSFT built SDK and the source-built one (Unix distros). We try to avoid any of these differences whenever possible. Please provide more details on why this was necessary.

@YuliiaKovalova YuliiaKovalova force-pushed the darc-main-2d50c190-03d7-4685-ace2-834d6744fa74 branch 2 times, most recently from 7f1f3b0 to 3153cc7 Compare March 4, 2026 14:05
@am11
Copy link
Copy Markdown
Member

am11 commented Mar 4, 2026

Out of curiosity, why does 3153cc7 suggest host package isn't available when msbuild explicitly depends on runtime (which builds the host package):

<RepositoryReference Include="runtime" />

cc @jkoritzinsky

@ViktorHofer
Copy link
Copy Markdown
Member

ViktorHofer commented Mar 4, 2026

Right, the (non-portable distro specific) host package is available in SB.

@YuliiaKovalova
Copy link
Copy Markdown
Member

Right, the (non-portable distro specific) host package is available in SB.

you have right, I am investigating it more.

@YuliiaKovalova YuliiaKovalova force-pushed the darc-main-2d50c190-03d7-4685-ace2-834d6744fa74 branch from 454ddd0 to f083f19 Compare March 4, 2026 16:05
@dotnet-maestro
Copy link
Copy Markdown
Contributor Author

dotnet-maestro bot commented Mar 5, 2026

Note

PRs from original repository included in this codeflow update:

💡 You may consult the FAQ for more information or tag @dotnet/prodconsvcs for assistance.

TryFromMSBuildAppHost and TryFromAppContextBaseDirectory now check
IsRunningInMSBuildExe before using the MSBuild apphost as the current
MSBuild executable. Without this, worker nodes get launched via the
apphost, changing Environment.ProcessPath to the SDK directory where
dotnet is not present, breaking Process.Start("dotnet") resolution
in tasks like VSTestTask.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-maestro
Copy link
Copy Markdown
Contributor Author

dotnet-maestro bot commented Mar 6, 2026

@dotnet-policy-service dotnet-policy-service bot requested a review from a team March 6, 2026 02:10
@dkurepa
Copy link
Copy Markdown
Member

dkurepa commented Mar 6, 2026

the PR is green now, can we merge it?

@YuliiaKovalova
Copy link
Copy Markdown
Member

the PR is green now, can we merge it?

could we please hold it till the end of the day - I want to check if we can avoid shipping .tlb + fix for VSTestTask (i run my experiments in a separate branch)

@dotnet-maestro
Copy link
Copy Markdown
Contributor Author

dotnet-maestro bot commented Mar 7, 2026

Note

PRs from original repository included in this codeflow update:

💡 You may consult the FAQ for more information or tag @dotnet/prodconsvcs for assistance.

YuliiaKovalova and others added 2 commits March 9, 2026 10:46
…ing in binary

- Remove checked-in .tlb binary from sdk Layout; generate at build time
  via tlbexp.exe during net472 build (CreateTypeLib target)
- Unified tlbexp.exe resolution: registry-based lookup with hardcoded
  fallback, works on both desktop and Core MSBuild (no MSBuildRuntimeType branching)
- Generate both x86 and x64 type libraries in all builds
  (the .tlb ships in both Visual Studio and the .NET SDK on Windows)
- Enable CreateTlb in VMR Windows builds (DotNetBuildSourceOnly != true)
- Include .tlb in Microsoft.Build.Framework NuGet package (lib/net472/)
- SDK layout copies .tlb from NuGet package cache with Exists() guard

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…per workaround

VSTestTask: Use DOTNET_HOST_PATH environment variable (set by the SDK) to
resolve the dotnet host path, with PATH search as fallback. This is the
proper fix for the 'dotnet not found' error that occurs when MSBuild runs
via the apphost and Environment.ProcessPath changes to the SDK directory.

BuildEnvironmentHelper: Revert the IsRunningInMSBuildExe guard in
TryFromMSBuildAppHost and the context-aware logic in
TryFromAppContextBaseDirectory. These were workarounds for the same issue
and are no longer needed now that VSTestTask resolves dotnet properly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service dotnet-policy-service bot requested a review from a team March 9, 2026 09:48
@YuliiaKovalova
Copy link
Copy Markdown
Member

the same here: After the final look from @rainersigwald , it's ready to go.

@dotnet-maestro dotnet-maestro bot merged commit 5f4c69f into main Mar 9, 2026
16 checks passed
@dotnet-maestro dotnet-maestro bot deleted the darc-main-2d50c190-03d7-4685-ace2-834d6744fa74 branch March 9, 2026 13:26
@dotnet-policy-service dotnet-policy-service bot requested a review from a team March 9, 2026 13:27
@YuliiaKovalova
Copy link
Copy Markdown
Member

the PR contains installer changes for dotnet/msbuild#12995

YuliiaKovalova added a commit to dotnet/sdk that referenced this pull request Mar 18, 2026
MSBuild's apphost support (dotnet/msbuild#13175) requires DOTNET_HOST_PATH
to resolve DOTNET_ROOT when launching out-of-proc task hosts for
TaskHostFactory tasks (e.g. ComputeWasmBuildAssets, ComputeManagedAssemblies).

The MSBuild apphost is now created in the SDK layout (dotnet/dotnet#5183),
so ResolveAppHostOrFallback takes the apphost code path. It calls
CreateDotnetRootEnvironmentOverrides which derives DOTNET_ROOT from
DOTNET_HOST_PATH. While the dotnet CLI sets this internally, explicitly
providing it in the test environment ensures it is available for the
task host subprocess launch.

Also enable MSBUILDDEBUGCOMM tracing to capture handshake details for
diagnosing any remaining task host connection issues.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
YuliiaKovalova added a commit to dotnet/sdk that referenced this pull request Mar 18, 2026
MSBuild's apphost support (dotnet/msbuild#13175) requires DOTNET_HOST_PATH
to resolve DOTNET_ROOT when launching out-of-proc task hosts for
TaskHostFactory tasks (e.g. ComputeWasmBuildAssets, ComputeManagedAssemblies).

The MSBuild apphost is now created in the SDK layout (dotnet/dotnet#5183),
so ResolveAppHostOrFallback takes the apphost code path. It calls
CreateDotnetRootEnvironmentOverrides which derives DOTNET_ROOT from
DOTNET_HOST_PATH. While the dotnet CLI sets this internally, explicitly
providing it in the test environment ensures it is available for the
task host subprocess launch.

Diagnostics added:
- DOTNET_HOST_PATH set in test environment variables
- MSBUILDDEBUGCOMM=1 for node communication tracing
- MSBuildDebugEngine=1 with MSBUILDDEBUGPATH for trace file output
- SDK layout dump in AoT_Publish test to verify MSBuild apphost presence

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

8 participants