- .NET Core Tutorial
- .NET Core - Home
- .NET Core - Overview
- .NET Core - Prerequisites
- .NET Core - Environment Setup
- .NET Core - Getting Started
- .NET Core - Numerics
- .NET Core - Garbage Collection
- .NET Core - Code Execution
- .NET Core - Modularity
- .NET Core - Project Files
- .NET Core - Package References
- Create UWP App with .NET Core
- .NET Core - MSBuild
- .NET Core - Metapackage
- Windows Runtime & Extension SDKs
- Create .NET Standard Library
- .NET Core - Portable Class Library
- Adding References to Library
- Sharing .NET Core Libraries
- Creating a Xamarin.Forms Project
- .NET Core - PCL Troubleshooting
- .NET Core - Create a Testing Project
- Running Tests in Visual Studio
- .NET Core - Testing Library
- Managed Extensibility Framework
- .NET Core - SDK
- .NET Core - MSBuild & project.json
- Restoring and Building & MSBuild
- .NET Core - Migrations
- .NET Core Useful Resources
- .NET Core - Quick Guide
- .NET Core - Useful Resources
- .NET Core - Discussion
Restoring and Building with MSBuild
In this chapter, we will discuss how to restore and build your MSBuild (*.csproj) file using the command line utility. 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 like 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.
To Continue Learning Please Login
Login with Google