-
Notifications
You must be signed in to change notification settings - Fork 1k
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
global.json is ignored if cwd is out of project or solution directory #28399
Comments
Do you have a reason to have a different CWD than the project you're acting on? The global.json lookup was designed as you described. CC @vitek-karas @elinor-fung for the host. |
In our case we use kind of a custom CI\CD batch of scripts and run Another reason is msbuild from BuildTools (or Visual Studio) can handle the situation when CWD is out of a solution directory and it would be nice to have the same and more versatile behavior. |
Currently the behavior is by-design. Adding @richlander who was looking into improvements in this area. |
Also running into this issue. |
I have a similar issue. My global.json is NOT in the solution folder, but in the folder of the project inside the solution folder. dotnet watch run works fine if run in the project folder. But global.json is ignored if dotnet watch run --project ProjectFolder/ProjectFile is run in the solution folder. So it looks like global.json is not really supported when option --project is used. |
That's because |
Additionally, there's no good way today to support solutions with multiple projects where each project has different requirements on the SDK (through different global.json) - building the solution is going to be done with a single instance of the SDK. |
Is your feature request related to a problem? Please describe.
Suppose I have a solution and global.json for that. There is a particular sdk version in the global.json. Then I go to the solution directory or any directory inside of the directory and all work fine, dotnet cli detects the global.json file and chooses the correct sdk version.
However, if cwd is not in the directory of solution, the global.json file is ignored, the latest version of sdk is choosen.
Describe the solution you'd like
Search for global.json file relatively csproj or sln file if one of them is set.
Additional context
These feature would be useful in some custom CI\CD pipelies. Otherwise, one has to change cwd to detect global.json correctly.
The text was updated successfully, but these errors were encountered: