The .NET SDK supplies the command-line tools and project templates used to create, manage, build, and run ASP.NET Core projects. Its `dotnet` commands work regardless of whether you edit code in Visual Studio or Visual Studio Code; an editor is not a substitute for the SDK. section 4.1 section 4.0
Set up and check the SDK before creating a project:
- Install the .NET 7 SDK separately if necessary. Visual Studio may install an SDK, but not the required version; Visual Studio Code does not install one. section 2.1.1 section 2.1.3
- Open a new PowerShell prompt and run `dotnet --list-sdks`. Check for a `7.0.1xx` entry; other SDK versions may also appear. section 2.1.1 section 2.1.3
For a repeatable ASP.NET Core setup, `dotnet new globaljson --sdk-version 7.0.100 --output FirstProject` creates a `global.json` file that specifies the SDK version. `dotnet new mvc --no-https --output FirstProject --framework net7.0` then uses the SDK’s MVC template to create a project targeting .NET 7. The template includes placeholder content: useful for getting started quickly, but not a reason to treat the generated application as a black box. section 2.2
Listing 2.3 Creating a new project
dotnet new globaljson --sdk-version 7.0.100 --output FirstProject dotnet new mvc --no-https --output FirstProject --framework net7.0 dotnet new sln -o FirstProject dotnet sln FirstProject add FirstProject
The complete command sequence shows how to create the version file and MVC project, then create a solution and add the project to it. section 2.2
Build, run, and check the result
From the project folder, run `dotnet build` to build it, or `dotnet run` to build and start it. In the shown application, static-file support is enabled in `Program.cs` and the HTTP port is set to 5000; requesting `http://localhost:5000/demo.html` displays the static HTML file. section 4.3
The command line also supports adding packages and installing tool commands. Visual Studio exposes some development tasks through its interface, but not every required feature is available through an editor or IDE. section 4.0
