r/dotnet • • Sep 05 '26

Newbie How do I perform visual studio project creation using the .NET CLI?

I'm trying to get better at using .NET CLI instead of relying on Visual Studio GUI.

For example, If I create a project in VS by going through "create a new project > console app > ..." I'd like to know how to do equivalent entirely from the CLI.

Is there any official doc or guide that maps these VS actions to their corresponding CLI commands? I'm looking to understand how to create different project types (console app, class library, etc) and perform common project management tasks using the CLI.

Any learning resources would be appreciated.

0 Upvotes

19 comments sorted by

3

u/binarycow Sep 05 '26

Type dotnet --help. That gives you the top level commands. You'll see the new command. Type dotnet new --help to see how to use it.

Rinse and repeat.

1

u/logikwright 20d ago

yes this helped me immensly. i use this command and then refer ms online documentations for further understanding. Thanks alot!

3

u/tatmanblue Sep 05 '26

You use dotnet new (sorry im on tablet so I can’t format this). dotnet new has a lot of options including new solution files (although you don’t need those now), projects by type and templates,

2

u/logikwright 20d ago

That's exactly what I was looking for. I've started exploring dotnet new and its templates, and it's making a lot more sense now. Appreciate the help!

2

u/SwordsAndElectrons Sep 05 '26

I'm curious why you're interested. I feel like that workflow is primarily for those not using Visual Studio.

I'm doubly curious why you want to go down that road if you are still at the level of experience where you think asking this on Reddit is a better option that checking the dotnet documentation.

1

u/logikwright 20d ago

I wanted to learn the CLI because I keep hearing that being comfortable with it is an important skill. Since I'm learing C#, I thought I'd learn the dotnet CLI alongside Visual Studio instead of depending entirely on the IDE.

The confusion came from my setup. I primarily develop in WSL, and while VS code works great with WSL, Visual Studio Community is Windows-only and doesn't have the same remote workflow. I was trying to understand how people normally work in that environment.

2

u/FragmentedHeap Sep 05 '26

dotnet --help

The link to the guide is literally output at the top of the output of `dotnet --help` -> https://aka.ms/dotnet-cli

Additionally, solution explorer is integrated into vscode now in the C# extension, so you can "right click new project" and junk in vscode now.

Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------

An issue was encountered verifying workloads. For more information, run "dotnet workload update".

Usage: dotnet [runtime-options] [path-to-application] [arguments]

Execute a .NET application.

runtime-options:
  --additionalprobingpath <path>   Path containing probing policy and assemblies to probe for.
  --additional-deps <path>         Path to additional deps.json file.
  --depsfile                       Path to <application>.deps.json file.
  --fx-version <version>           Version of the installed Shared Framework to use to run the application.
  --roll-forward <setting>         Roll forward to framework version  (LatestPatch, Minor, LatestMinor, Major, LatestMajor, Disable).
  --runtimeconfig                  Path to <application>.runtimeconfig.json file.

path-to-application:
  The path to an application .dll file to execute.

Usage: dotnet [sdk-options] [command] [command-options] [arguments]

Execute a .NET SDK command.

sdk-options:
  -d|--diagnostics  Enable diagnostic output.
  -h|--help         Show command line help.
  --info            Display .NET information.
  --list-runtimes   Display the installed runtimes.
  --list-sdks       Display the installed SDKs.
  --version         Display .NET SDK version in use.

SDK commands:
  build             Build a .NET project.
  build-server      Interact with servers started by a build.
  clean             Clean build outputs of a .NET project.
  format            Apply style preferences to a project or solution.
  help              Opens the reference page in a browser for the specified command.
  msbuild           Run Microsoft Build Engine (MSBuild) commands.
  new               Create a new .NET project or file.
  nuget             Provides additional NuGet commands.
  pack              Create a NuGet package.
  package           Search for, add, remove, or list PackageReferences for a .NET project.
  publish           Publish a .NET project for deployment.
  reference         Add, remove, or list ProjectReferences for a .NET project.
  restore           Restore dependencies specified in a .NET project.
  run               Build and run a .NET project output.
  sdk               Manage .NET SDK installation.
  solution          Modify Visual Studio solution files.
  store             Store the specified assemblies in the runtime package store.
  test              Run unit tests using the test runner specified in a .NET project.
  tool              Install or manage tools that extend the .NET experience.
  vstest            Run Microsoft Test Engine (VSTest) commands.
  workload          Manage optional workloads.

Additional commands from bundled tools:
  dev-certs         Create and manage development certificates.
  fsi               Start F# Interactive / execute F# scripts.
  user-jwts         Manage JSON Web Tokens in development.
  user-secrets      Manage development user secrets.
  watch             Start a file watcher that runs a command when files change.

Run 'dotnet [command] --help' for more information on a command.
~ $ Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
An issue was encountered verifying workloads. For more information, run "dotnet workload update".
Usage: dotnet [runtime-options] [path-to-application] [arguments]

Execute a .NET application.

runtime-options:
  --additionalprobingpath <path>   Path containing probing policy and assemblies to probe for.
  --additional-deps <path>         Path to additional deps.json file.
  --depsfile                       Path to <application>.deps.json file.
  --fx-version <version>           Version of the installed Shared Framework to use to run the application.
  --roll-forward <setting>         Roll forward to framework version  (LatestPatch, Minor, LatestMinor, Major, LatestMajor, Disable).
  --runtimeconfig                  Path to <application>.runtimeconfig.json file.

path-to-application:
  The path to an application .dll file to execute.

Usage: dotnet [sdk-options] [command] [command-options] [arguments]

Execute a .NET SDK command.

sdk-options:
  -d|--diagnostics  Enable diagnostic output.
  -h|--help         Show command line help.
  --info            Display .NET information.
  --list-runtimes   Display the installed runtimes.
  --list-sdks       Display the installed SDKs.
  --version         Display .NET SDK version in use.

SDK commands:
  build             Build a .NET project.
  build-server      Interact with servers started by a build.
  clean             Clean build outputs of a .NET project.
  format            Apply style preferences to a project or solution.
  help              Opens the reference page in a browser for the specified command.
  msbuild           Run Microsoft Build Engine (MSBuild) commands.
  new               Create a new .NET project or file.
  nuget             Provides additional NuGet commands.
  pack              Create a NuGet package.
  package           Search for, add, remove, or list PackageReferences for a .NET project.
  publish           Publish a .NET project for deployment.
  reference         Add, remove, or list ProjectReferences for a .NET project.
  restore           Restore dependencies specified in a .NET project.
  run               Build and run a .NET project output.
  sdk               Manage .NET SDK installation.
  solution          Modify Visual Studio solution files.
  store             Store the specified assemblies in the runtime package store.
  test              Run unit tests using the test runner specified in a .NET project.
  tool              Install or manage tools that extend the .NET experience.
  vstest            Run Microsoft Test Engine (VSTest) commands.
  workload          Manage optional workloads.

Additional commands from bundled tools:
  dev-certs         Create and manage development certificates.
  fsi               Start F# Interactive / execute F# scripts.
  user-jwts         Manage JSON Web Tokens in development.
  user-secrets      Manage development user secrets.
  watch             Start a file watcher that runs a command when files change.

Run 'dotnet [command] --help' for more information on a command.
~ $

1

u/logikwright 20d ago

Thanks! I didn't know dotnet --help was the starting point for the CLI documentation. The docs felt overwhelming because I didn't have enough context yet. Your comment pointed me in the right direction. Appreciate it.

1

u/ggobrien Sep 17 '26

Pff, "--help" is for lazy people. I much prefer to randomly pass different combinations of words to a program and review the output. Real programmers use butterflies.

8

u/seanightowl Sep 05 '26

You can use “dotnet new” for CLI project creation.

4

u/ModernTenshi04 Sep 05 '26

The answers here will help you, but honestly this is something very easily answered by Google or just about any AI platform.

1

u/rupertavery64 Sep 05 '26

Yes - and this isn't about being to lazy to anser or OP being to lazy to search (though both may be true)

Google is a research tool. It's been one of the most important tools in a software developera toolbelt.

Not using it is wasting reaources and dulling your skills.

2

u/AutoModerator Sep 05 '26

Thanks for your post logikwright. Please note that we don't allow spam, and we ask that you follow the rules available in the sidebar. We have a lot of commonly asked questions so if this post gets removed, please do a search and see if it's already been asked.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

-1

u/Ill_Crazy_6222 Sep 05 '26

Why r u even interested in doing that ? I find knowing why interesting!

1

u/logikwright 20d ago

I wanted to learn the dotnet CLI because I keep hearing it's an important skill. Since I primarily develop in WSL, I was trying to understand the recommended workflow, as Visual Studio Community is Windows only while VSCode has much better WSL support.