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.

dotnet format and file-scoped namespaces

See original GitHub issue

I’m running on: dotnet --version 6.0.100-rc.2.21505.57

My .editorconfig file contains:

# Namespaces
csharp_style_namespace_declarations = file_scoped

Running dotnet format style does not convert namespaces to file-scoped single-line namespaces.

I’d thought this was supported already. If not, is it coming soon? If so, any idea what I’m doing wrong?

Thanks!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
ardaliscommented, Oct 24, 2021

It’s all working. I created a short YouTube video covering the necessary steps. Feel free to share if you think it’s helpful:

https://www.youtube.com/watch?v=xbq7fbg8UxA&ab_channel=NimblePros

0reactions
ardaliscommented, Oct 21, 2021

Ah, that makes sense, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dotnet Format and File Scoped Namespaces | Blog
The dotnet format tool is a great way to quickly apply formatting from your .editorconfig to your entire project or solution. It handles...
Read more >
File scoped namespaces - C# feature specifications
This feature specification describes file scoped namespaces, where the entire contents of a file are included in a namespace declared at the ...
Read more >
Use dotnet format to switch to file-scoped namespaces
I'm trying to use the dotnet format command to convert a large C# solution to leverage file-scoped namespaces.
Read more >
Updating your project to use File Scoped Namespaces
The solution is to use Visual Studio or dotnet format to update your project to use File Scoped Namespaces. First, you need to...
Read more >
Using File-Scoped Namespaces in .NET 6 | by Jamie Burns
As its name implies, a file-scoped namespace is a namespace that has the whole file as its scope. Let's look at an example....
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