As a .NET Core developer using VS Code on Windows, optimizing your workflow with the right commands can boost productivity and streamline development. Whether you are coding, debugging, building, or deploying, these essential VS Code commands and .NET CLI commands will make your life easier.
1. Setting Up Your .NET Core Project
Create a New .NET Core Project
Use the following command to create a new .NET Core project:
dotnet new console -o MyApp
cd MyAppIf you are creating ASP.NET Core MVC app:
dotnet new mvc -o MyWebApp
cd MyWebApp2. Essential Commands for Development
Run the Application
Run your app using:
dotnet runRestore Dependencies
If you clone a project, restore NuGet dependencies:
dotnet restoreInstall a New NuGet Package
To install a package (e.g., Newtonsoft.Json):
dotnet add package Newtonsoft.JsonList Installed Packages
dotnet list package3. Debugging & Testing
Start Debugging in VS Code
Press F5 or run:
dotnet watch runThis enables hot reload and automatically restarts the app when you make changes.
Run Unit Tests
If you are using xUnit, NUnit, or MSTest, run:
dotnet test4. Building & Publishing the App
Build the Project
dotnet buildThis compiles the application and checks for errors.
Publish for Deployment
For self-contained deployment:
dotnet publish -c Release -r win-x64 --self-contained true -o ./publishFor Azure App Service deployment:
dotnet publish -c Release -o ./publish5. Deploying to Azure from VS Code
Login to Azure
az loginDeploy to Azure App Service
- Open the Command Palette in VS Code (
Ctrl+Shift+P). - Select “Azure App Service: Deploy to Web App…”.
- Choose your app and deploy.
Alternatively, you can install Azure widget to connect and deploy the web to Azure App service. Follow this link –
6. Git Commands for Source Control
Initialize Git in the Project
git initAdd Files and Commit
git add .
git commit -m "Initial commit"Push Code to GitHub
git remote add origin https://github.com/your-repo.git
git push -u origin mainConclusion
These commands will boost your efficiency as a .NET Core developer in VS Code. Whether you’re writing code, debugging, building, or deploying, these shortcuts will help you work smarter, not harder.
🚀 Do you have other favorite VS Code or .NET CLI commands? Share them in the comments!
Keep Following- SharePointCafe.NET




Leave a Reply