dotnet-generate 1.2.0

dotnet tool install --global dotnet-generate --version 1.2.0                
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-generate --version 1.2.0                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=dotnet-generate&version=1.2.0                
nuke :add-package dotnet-generate --version 1.2.0                

dotnet-generate

A .Net tool for generating files via the CLI to run similar to the way that the Angular CLI runs.

Installation

Run this command to install the NuGet package to your global dotnet toolset:

dotnet tool install --global dotnet-generate

Run

dotnet generate <schematic> <path> [options]

The file will be created in the current working directory of where the console is running unless a more specific path is provided.

Now as visual studio code extension

Check out the extension here

Arguments

Argument Description Value Type
schematic The type of file you want to create. This can either be a long or short value. Currently supported types, with short value in square brackets are: [c]lass, [i]nterface, [e]num string
path The path to the folder relative to your current working directory. If you want to go from the project root path start the value with ./. You do not need to enter in a file extension string

Options

Option (long) Option (short) Description Value Type Default
--dry-run -d If you want to see what would happen turn on the dry run function which will describe the process it would go through bool false
--force -f If true and the file path you entered exists, then the file will be overwritten, if false then the process will stop bool false
--public -p Set the visibility of the file to public bool true
--private -pr Set the visibility of the file to private bool false
--internal -in Set the visibility of the file to internal bool false
--abstract -a Add the abstract modifier bool false
--static -s Add the static modifier bool false
--inherits -i Type the name of a type that you want this to inherit from string ""
--list -ls Show a list of the currently supported schematics bool false
--open -o Run open command after creating file. By default it is appended to the end unless it contains {path} where the full path to the file is provided string ""

Change Log

Version 1.1

  • Added support for --open command
  • Changed the visibility modifiers to be --public, --private and --internal for easier use
  • Added new schematic or generating a class and an interface at once
  • Fixed an issue with namespaces being wrong
  • Added schematic detail to the --list command

Please note: The open command is still experimental so if you have any issues please raise an Issue on Github

Future Development

Go here for the roadmap of the project

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  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.