You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When global.json has higher version of SDK than the one dotnet-format was built against, we get an unfreindly error:
Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer.
Steps to repro
# bash on macOS# shallow clone dotnet/runtime's master branch> git clone https://github.com/dotnet/runtime --single-branch --depth 1
# run dotnet-format out of the tree with --folder option> dotnet-format runtime/src/libraries/System.Drawing.Common/src/System/Drawing/ --folder
Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer.
# failed, return code>echo$?
3
support this scenario with --folder option, by ignoring the SDK version mismatch and just format the code files. Maybe with a warning message, e.g. Some language features might not be supported. For optimal results, upgrade dotnet-format to latest version.
produce friendly message; something in between the lines of The SDK version in runtime/global.json is unsupported by dotnet-format.
@am11 As of this PR - #760 - the 5.x builds no longer look for a MSBuild instance when using the --folder option.
When a global.json specifies a particular SDK, that SDK location will only be reported if it is installed. My assumption about what you ran into is that the version specified by the Runtime's global.json wasn't installed. Could you try running the Runtime's restore script to ensure the proper SDK is installed?
In my real case, I built the entire runtime repo (to test my branch) before issuing a PR, so the SDK (5.0 preview8) was installed in runtime's default location (under runtime/.dotnet). It was failing with v4.
With v5, even without restoring the runtime (i.e. fresh clone), it works with the --folder option.
Looking forward to the next official release. v5 has tons of improvements that I am fan of. ;)
When global.json has higher version of SDK than the one dotnet-format was built against, we get an unfreindly error:
Steps to repro
Workaround
Expected behavior
Either dotnet-format:
--folder
option, by ignoring the SDK version mismatch and just format the code files. Maybe with a warning message, e.g.Some language features might not be supported. For optimal results, upgrade dotnet-format to latest version
.The SDK version in runtime/global.json is unsupported by dotnet-format
.Version info
The text was updated successfully, but these errors were encountered: