dotnet-fsns 1.0.0.1

dotnet tool install --global dotnet-fsns --version 1.0.0.1
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local dotnet-fsns --version 1.0.0.1
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=dotnet-fsns&version=1.0.0.1
nuke :add-package dotnet-fsns --version 1.0.0.1

File Scope Namespacer

Converts C# files from block scoped namespace to file scoped namespace. Can convert either a single file or can recurse through an entire folder tree.

So:

namespace MyNamespace
{
    using System;

    public class MyClass
    {
        ...
    }
}

Becomes:

namespace Mynamespace;

using System;

public class MyClass
{
    ...
}

The tools will detect and respect indentation method (tabs vs spaces) and line feed endings.

Usage

Usage:
  dotnet-fsns [command] [options]

Options:
  --replace        Replace file with new version.  !!WARNING: Cannot be undone.
  --skip-designer  Skip files that end in designer.cs.
  --version        Show version information
  -?, -h, --help   Show help and usage information

Commands:
  file <--target>    Change a single file to file scoped namespace.
  folder <--target>  Change a whole folder to file scoped namespace.

Examples:

dotnet fsns file --target /Project1/Class1.cs or dotnet-fsns file --target /Project1/Class1.cs

Will create Class1.out.cs with the amendments.

dotnet fsns folder --target /Project1 --replace true or dotnet-fsns folder --target /Project1 --replace true

Will update all files and overwrite in place.

Notes

By default the tool will skip any files that are already file-scoped, as well as the following:

  • Any files ending in designer.cs
  • Any files in the bin and obj folders
  • Any files with the comment // <auto-generated>
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
1.0.0.1 239 5/23/2022