-
Notifications
You must be signed in to change notification settings - Fork 172
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
dotnet format does not respect global.json and breaks when preview versions of .NET is installed #1500
Comments
I had to work around this issue by completely uninstalling Visual Studio 2022 preview. |
It seems this is intended: #1292 last bullet point. It's painful for me too, but then I don't know the reasons behind 🤷 |
@CaringDev Oh damn, thanks for that link. That's just broken by design then. :( |
Workaround: |
This also has an impact on the GitHub Actions runner. They have been updated to the lastest SDK an now the |
Any news on this? This is pretty annoying to work with. |
Agreed, I had to uninstall VS Preview again the other day because of this. |
Any plan to fix this or introduce some sort of workaround to allow to use |
@JoeRobich can someone at least look at this, or give some feedback please. |
The correct dotnet-format is being run based on global.json, but the issue here is that we are taking the highest versioned MSBuild (and thus SDK) returned by MSBuildLocator. This is a behavior that was quite useful when we shipped only as a dotnet tool but is undesirable now that we are in the SDK. This is something I can look at in the July development sprint. |
@JoeRobich Thank you for the clarification 💯 |
A possible workaround is to install it as global tool dotnet tool install -g dotnet-format --version "7.*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json (not sure if there is a different feed where 6.* is available) and then running it as |
Any news on this one? Can't find any PR for this. |
The same in 8.0-Preview1. |
It is not only the issue of preview version. Any SDK with only patch level difference is affected. E.g. 6.0.122 and 6.0.401. |
This breaks our pull request build pipelines since the formatting in dotnet 8 seems to be a bit different from dotnet 6 which our global.json defines as the sdk. Any updates on an actual fix? A possible workaround is to add this to your pipeline before the formatting:
|
Please fix this. |
I am unable to use dotnet format in my projects because it throws the following error:
This seems to be because it is trying to load assemblies from .NET 6.0.200 preview even though I have the following global.json in my project:
The following log output illustrates the problem:
The text was updated successfully, but these errors were encountered: