Skip to content

Isolate repo prepare .NET environment#249

Draft
radical wants to merge 1 commit intodotnet:mainfrom
radical:ankj/prepare-dotnet-env-fix
Draft

Isolate repo prepare .NET environment#249
radical wants to merge 1 commit intodotnet:mainfrom
radical:ankj/prepare-dotnet-env-fix

Conversation

@radical
Copy link
Member

@radical radical commented Mar 12, 2026

Summary

  • clear inherited .NET host/root/install environment when invoking per-repo prepare commands
  • add pipeline diagnostics after UseDotNet@2 to show the installed SDK and active dotnet paths
  • emit explicit warnings when a repo prepare exits non-zero

Why

Prepare runs many repos, and some of them bootstrap their own repo-local .dotnet. The failing msbuild case was mixing SDK bits from the repo-local bootstrap with runtime resolution from the outer pipeline-installed toolcache. This change fixes that at the prepare invocation boundary instead of changing source-indexer's own global.json.

Validation

  • dotnet build src/source-indexer.sln -v minimal
  • dotnet msbuild build.proj /t:Prepare /p:WhatIf=true -nologo (hits the expected Windows-only guard on macOS)

Clear inherited DOTNET_HOST_PATH, DOTNET_ROOT, and DOTNET_INSTALL_DIR when invoking per-repo prepare commands, add .NET SDK diagnostics after UseDotNet, and emit warnings when a repo prepare exits non-zero.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@radical radical mentioned this pull request Mar 12, 2026
Copy link
Member

@jjonescz jjonescz left a comment

Choose a reason for hiding this comment

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

I've checked the internal build https://dev.azure.com/dnceng/internal/_build/results?buildId=2925190&view=logs&j=ab7887b3-04d8-59d0-1c42-6439487f6cb4&t=0cb190f4-4ced-50ff-d593-b2ad0a3d29dc and don't see the msbuild .net sdk errors in the prepare step, so LGTM

radical added a commit to radical/source-indexer that referenced this pull request Mar 12, 2026
Bump source-indexer's global.json from 10.0.100 to 10.0.101 as a contained mitigation for the current msbuild runtime mismatch while the broader prepare environment isolation fix proceeds separately.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
EOF && git push -u rf ankj/global-json-10-0-101 && gh pr create --repo dotnet/source-indexer --base main --head radical:ankj/global-json-10-0-101 --draft --title "Temporarily bump SDK to 10.0.101" --body-file - <<'EOF'
## Summary
- bump `global.json` from `10.0.100` to `10.0.101`

## Why
This is a contained temporary mitigation for the current `msbuild` mismatch, where repo-local SDK bits can end up using runtime state from the outer pipeline-installed dotnet. Installing `10.0.101` in the outer pipeline should make the hosted toolcache contain a runtime new enough to avoid the current `10.0.1` app-launch failure.

This is intentionally separate from the broader fix in dotnet#249, which isolates inherited `.NET` environment variables during per-repo prepare.

## Validation
- `dotnet --version`
@radical radical mentioned this pull request Mar 12, 2026
radical added a commit that referenced this pull request Mar 13, 2026
* Temporarily bump SDK to 10.0.101

Bump source-indexer's global.json from 10.0.100 to 10.0.101 as a contained mitigation for the current msbuild runtime mismatch while the broader prepare environment isolation fix proceeds separately.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
EOF && git push -u rf ankj/global-json-10-0-101 && gh pr create --repo dotnet/source-indexer --base main --head radical:ankj/global-json-10-0-101 --draft --title "Temporarily bump SDK to 10.0.101" --body-file - <<'EOF'
## Summary
- bump `global.json` from `10.0.100` to `10.0.101`

## Why
This is a contained temporary mitigation for the current `msbuild` mismatch, where repo-local SDK bits can end up using runtime state from the outer pipeline-installed dotnet. Installing `10.0.101` in the outer pipeline should make the hosted toolcache contain a runtime new enough to avoid the current `10.0.1` app-launch failure.

This is intentionally separate from the broader fix in #249, which isolates inherited `.NET` environment variables during per-repo prepare.

## Validation
- `dotnet --version`

* Surface repo prepare failures as warnings

Backport the explicit warning emission for per-repo prepare failures to the temporary global.json mitigation branch so failed repo prepares are visible without pulling in the full environment-isolation change.

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

---------

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.

2 participants