In your command prompt, run the following command to create your app:
In your terminal, run the following commands to create your app:
dotnet new console -o MyApp -f net7.0
Then, navigate to the new directory created by the previous command:
dotnet new consolecommand creates a new console app for you.
-oparameter creates a directory named
MyAppwhere your app is stored and populates it with the required files.
-fparameter indicates you're creating a .NET 7 application.
cd MyAppchanges your current directory to the one just created for the new app.
The main file in the
MyApp folder is called
Program.cs. By default, it already contains the necessary code to write "Hello, World!" to the Console. The following code shows the contents of this file when the project is created:
// See https://aka.ms/new-console-template for more information Console.WriteLine("Hello, World!");
Select the Continue button below to go to the next step.
If you receive a message similar to
Template "Console Application" could not be created. Access to the path 'C:\Windows\System32\MyApp' is denied., change your current directory to one where you have permissions to create a new folder and try to run the command again. If you can't resolve the issue, use the I ran into an issue button below to get help fixing the problem.
If Windows can't find the SDK when you try to create the project and you are sure you have installed the SDK, your machine might have an issue with the PATH environment variable. See this Stack Overflow post for instructions on how to diagnose and fix this issue.
If you can't resolve the issue you're having, select the I ran into an issue button below to get help fixing the problem.