Skip to content

Conversation

MiYanni
Copy link
Member

@MiYanni MiYanni commented Sep 18, 2025

Summary

With the addition of sdk.paths to the global.json, the dogfood script (used for testing the built SDK in the repo) if ran from the eng folder (the location of the script) won't use the correct SDK. What happens is it'll walk up from eng and find the global.json. Then it will default to the SDK in the .dotnet folder, which is downloaded during the build of the SDK itself, instead of the -dev version:

image

So, what I did to avoid this problem is made the dogfood script change from the current working directory to the UserProfile (Windows) and Home (Linux/Mac). This means that if you run the dogfood script in the folder it is located, you'll no longer resolve to the global.json of the repo, and thus no longer use the SDK in the .dotnet folder:

image

@MiYanni MiYanni requested review from baronfel, a team and Copilot September 18, 2025 00:43
Copy link
Contributor

This PR is targeting main, which is now for .NET 11-facing work. If you intended to target .NET 10, either retarget this PR to release/10.0.1xx or make sure you backport the change to release/10.0.1xx after merging. See #50394 for more details.

Copy link
Contributor

@Copilot 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 where the dogfood script (used for testing the built SDK) would incorrectly resolve to the repo's global.json and use the wrong SDK version when run from the eng folder. The fix changes the working directory to the user's home directory to avoid SDK resolution conflicts.

Key changes:

  • Modifies dogfood scripts to change working directory to user home
  • Prevents incorrect SDK resolution when scripts are run from their location in the eng folder

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
eng/dogfood.sh Adds cd command to change to home directory
eng/dogfood.ps1 Modifies prompt function to set location to USERPROFILE

@baronfel baronfel enabled auto-merge (squash) September 19, 2025 20:32
Copy link
Member

@dsplaisted dsplaisted left a comment

Choose a reason for hiding this comment

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

If we want to do this, can we change the directory to artifacts\tmp\Debug instead? That's where most of the tests are run from and usually when I use the dogfood script it's to investigate / debug a project created by tests.

It seems like we would need an empty global.json in that folder to stop the tests from using the wrong SDK version. It doesn't seem like there is one so I'm not really sure how everything is working now.

@MiYanni
Copy link
Member Author

MiYanni commented Sep 24, 2025

@dsplaisted I haven't tested it, but would using artifacts\tmp\Debug even work? I thought the point of this change was that so there isn't a global.json in the "file tree" from your working directory. Meaning, going up from current dir to the drive root, there's no global.json. I picked the UserProfile dir as it is the default for both cmd and PowerShell. Plus, it's path tree is tiny and highly unlikely to contain a global.json.

@dsplaisted
Copy link
Member

@dsplaisted I haven't tested it, but would using artifacts\tmp\Debug even work? I thought the point of this change was that so there isn't a global.json in the "file tree" from your working directory. Meaning, going up from current dir to the drive root, there's no global.json. I picked the UserProfile dir as it is the default for both cmd and PowerShell. Plus, it's path tree is tiny and highly unlikely to contain a global.json.

Yeah I'm confused because I thought we had to put an empty global.json in that folder or the tests wouldn't use the right version of the SDK.

@MiYanni
Copy link
Member Author

MiYanni commented Sep 24, 2025

@dsplaisted

Yeah I'm confused because I thought we had to put an empty global.json in that folder or the tests wouldn't use the right version of the SDK.

So, looking... the build puts a global.json in a slightly different path: artifacts\tmp\Debug\testing

image

But that global.json isn't empty either:

image

It directly points to the built SDK, which makes sense. Do you think this folder makes more sense than the UserProfile?

@nagilson
Copy link
Member

Great observation, I think that folder makes more sense than the user profile. It will allow us to configure the experience more and reduce risk of breaking changes from devs having some json file in HOME. Note that this folder does disable CPM.

@MiYanni
Copy link
Member Author

MiYanni commented Sep 30, 2025

@nagilson @dsplaisted I've updated the path to artifacts\tmp\Debug\testing. PTAL

image

@MiYanni
Copy link
Member Author

MiYanni commented Oct 1, 2025

This change requires this change: #51020

@MiYanni MiYanni added the Blocked Issue is blocked on an external dependency label Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocked Issue is blocked on an external dependency
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants