question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

--folder option is different in SDK bundled tool vs. mainline

See original GitHub issue

Using the nightly (5 hours old) .NET SDK 6.0.100-rtm.21514.1 with bundled dotnet-format, --folder option doesn’t have any effect.

$ dotnet6 format --version
6.0.251401+3ec0d2e1ffc98b76dca28aa23326ba0a1425dd82

# note that despite --folder, it is trying to load the workspace from csproj
$ ls *.cs | dotnet6 format --include - --folder -v:d
  The dotnet runtime version is '6.0.0-rtm.21513.22'.
  Formatting code files in workspace '/home/am11/projects/cs1/cs1.csproj'.
    Determining projects to restore...
  Restored /home/am11/projects/cs1/cs1.csproj (in 251 ms).
  Project cs1 is using configuration from '/home/am11/projects/cs1/obj/Debug/net5.0/cs1.GeneratedMSBuildEditorConfig.editorconfig'.
  Project cs1 is using configuration from '/home/am11/.dotnet6/sdk/6.0.100-rtm.21514.1/Sdks/Microsoft.NET.Sdk/analyzers/build/config/analysislevel_5_default.editorconfig'.
  Running 1 analyzers on cs1.
  Formatted 0 of 4 files.
  Format complete in 10099ms.

with latest 5x (3 days old) downloaded from nuget.org, we get:

$ dotnet-format --version
5.1.250801+4a851ea9707f87d381166c2fc2b2d4b58a10a222

$ ls *.cs | dotnet-format --include - --folder -v:d
  The dotnet format version is '5.1.250801+4a851ea9707f87d381166c2fc2b2d4b58a10a222'.
  Formatting code files in workspace '/home/am11/projects/cs1'.
/home/am11/projects/cs1/Program.cs(1,1): error WHITESPACE: Fix whitespace formatting. [/home/am11/projects/cs1]
/home/am11/projects/cs1/Program2.cs(1,1): error WHITESPACE: Fix whitespace formatting. [/home/am11/projects/cs1]
  Formatted code file '/home/am11/projects/cs1/Program.cs'.
  Formatted code file '/home/am11/projects/cs1/Program2.cs'.
  Formatted 2 of 2 files.
  Format complete in 3514ms.

The expected behavior implemented by https://github.com/dotnet/format/pull/790.

Was it intentionally dropped out of .NET 6?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
cliffchapmanrbxcommented, Apr 8, 2022

As we’re rolling out .NET 6 across our build infrastructure we got burned by this today.

We have a repository with over 1700 separate csproj files and around 800 SLN files. All told there’s approximately 5.5 million LoC in the repo. To keep the entire repository in line we’ve been using an automated dotnet tool run dotnet-format --folder . command on the root of the repo for automatically applying fixes to folk’s pull requests. This workflow has worked great to keep things in check, especially as we have a well defined .editorconfig based on the Roslyn one with all of the rules written out.

It doesn’t appear that there is any way to replicate the current 5.X folder functionality, as the --folder option is only available for whitespace and not style.

0reactions
am11commented, Oct 16, 2021

Yup, I’m mainly using it for performance because the default, project workspace, takes ages in large projects. 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android studio- "SDK tools directory is missing"
This was an issue for me because I already had the SDK installed under a different directory. In order to tell Android Studio...
Read more >
How to Install Android Studio IDE & SDK and Get Started ...
In "Select UI Theme", use the default or choose one that you like. In "Verify Settings", take note of the SDK directory (by...
Read more >
Installation guide - GROMACS 2023.2 documentation
Installation guide#. Introduction to building GROMACS#. These instructions pertain to building GROMACS 2023.2. You might also want to check the up-to-date ...
Read more >
APEX file format
System component files packaged in an APEX are accessible via new paths like /apex/<name>/lib/libfoo.so . When the files were part of the /system...
Read more >
Building OpenJFX
Building a UI toolkit for many different platforms is a complex and challenging endeavor. It requires platform specific tools such as C ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found