- .NET Core - Migrations
- Restoring and Building & MSBuild
- .NET Core - MSBuild & project.json
- .NET Core - SDK
- Managed Extensibility Framework
- .NET Core - Testing Library
- Running Tests in Visual Studio
- .NET Core - Create a Testing Project
- .NET Core - PCL Troubleshooting
- Creating a Xamarin.Forms Project
- Sharing .NET Core Libraries
- Adding References to Library
- .NET Core - Portable Class Library
- Create .NET Standard Library
- Windows Runtime & Extension SDKs
- .NET Core - Metapackage
- .NET Core - MSBuild
- Create UWP App with .NET Core
- .NET Core - Package References
- .NET Core - Project Files
- .NET Core - Modularity
- .NET Core - Code Execution
- .NET Core - Garbage Collection
- .NET Core - Numerics
- .NET Core - Getting Started
- .NET Core - Environment Setup
- .NET Core - Prerequisites
- .NET Core - Overview
- .NET Core - Home
.NET Core Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Restoring and Building with MSBuild
In this chapter, we will discuss how to restore and build your MSBuild (*.csproj) file using the command pne utipty. To see what commands are available in .NET Core 2.0 preview 1, let us run the following command.
dotnet help
You will see all the commands pke new, restore, build, etc.
Following is the default implementation in Program.cs file.
using System; namespace MSBuild { class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); } } }
Let us now execute the following command to see the progress.
dotnet build
You will see a lot of errors. These errors need to be rectified.
Let us now run the following command.
dotnet restore
You can see that all the packages are restored. Some new folders and files have also been generated.
To see the directory structure, let us run the following command.
tree /f
Following is the directory structure −
Let us now rebuild the project running the following command again.
dotnet build
Now you project will build successfully without any error(s) and MSBuild.dll is also created.
To see the output, let us run the following command −
dotnet run
You can see the following output on your console.
Advertisements