Ever wondered that how build is executed in the build pipeline? Or maybe how tests are run in the build pipeline?
Well, DevOps certainly knows that. But .Net developers usually build the solution from visual studio using the menu.
Sometimes there will be too many errors or a glitch but commands can help you to know exact errors and eliminate the glitch if any.
Also these commands will be useful to build a pipeline.
Letβs get into the topic.
Pre requisite:
- .Net framework (.Net core or above recommended)
- Powershell or Developers Command Prompt for VS
Open the powershell/Developers Command Prompt and go to the directory where solution is located.
1) dotnet clean - Cleans the solution by removing obj, bin folders where build related files are being stored.
2) dotnet restore - Restore all the dependencies such as NuGet packages from the repository.
3) dotnet build - Build the solution, which will be ready to run.
4) dotnet test - Runs the tests from all of the test projects.
5) dotnet pack - Packs the solution so that it can be uploaded as an artifact.
6) dotnet publish - Publish the solution. Creates required files that needs to run the application in the publish folder.
Top comments (0)