.NET Core - MSBuild


Advertisements

In this chapter, we will discuss what is MSBuild and how it works with .NET Core. MSBuild is the build platform for Microsoft and Visual Studio. In UWP application if you open the project folder, then you will see both project.json and *.csproj files.

project.json

But if you open our previous .NET Core Console app, then you will see project.json and *.xproj files.

Files
  • The .NET Core build system or the project.json build system is not sufficient for UWP needs; this is why UWP is still using *.csproj (MSBuild) Build system.

  • But project.json will move out as far as the build system is concerned.

  • Now if you want to add a few existing files to your UWP application as we have added in the Console app, then you need to add those files in the project folder. Further, you will also need to include in your project in Solution Explorer as well.

Let us now consider the following files; copy these files to your project folder.

Project Folder

Projects

Let us go back to Visual Studio and open the Solution Explorer.

Solution Explorer
  • You can now see that only copying files is not sufficient in case of UWP applications, because in Solution Explorer, we can’t see those files.

  • Now we must include those files as well by clicking on the Show All Files icon as highlighted in the above screenshot and you will see now all files in the project folder.

Show All Files

These two files are still not included in our project. To include these files, select these files and right-click on any file and then select Include in Project.

Include in Project

Now these files are also included. One good thing that can be foreseen is the project.json approach of dropping files for *.csproj in the future version of the SKD tools and also to Visual Studio.

Advertisements