This project was created using dotnet
commandline and loaded into VSCode. There may be a few extentions required such as SwaggerUI, C#, ASP.NET,...
From a powershell terminal, do the followings:
-
Create a new folder and cd into it
-
Verify dotnet templates available, there should be one for
webapi
dotnet new --list
dotnet new webapi -h
dotnet new webapi -f net6.0 -o myWeatherAPI
cd myWeatherAPI
dotnet dev-certs https --trust
code .
At this stage, the project should be loading into VSCode.
- Open PowerShell terminal and type:
dotnet run
PS D:\DEVEL\C-SharpProjs\LINKEDIN_TRAINING_2023\.NET7API\hello\myHelloAPI> dotnet run --watch
Building...
info: Microsoft.Hosting.Lifetime[14]
Now listening on: https://localhost:5059
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: D:\DEVEL\C-SharpProjs\LINKEDIN_TRAINING_2023\.NET7API\hello\myHelloAPI
The IDE should build and launch the application via the project profiles tag for localhost:port
as specified in Properties/launchSettings.json
eg.
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:5059",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7214;http://localhost:5059",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},