MBuild Alpha Release .Net Core Tools in Visual Studio 2017
If you are looking for latest news about Visual Studio 2017, custom asp.net development services provider brings this post. This article explains the new release of .net core tools that are based on MSBuild. Read this article and make the best use of these tools.
The new release of .Net Core Tools based on MSBuild have been announced on Nov 16, 2016. The new tools for .Net Core can be tried in Mac Visual Studio or Visual Studio version 2017 RC or at commandline. These tools can run in both .Net Core 1.1 and 1.0 versions.
The new Release of Preview 3 has support for the csproj format and the MSBuild system. The MSBuild system was adopted for .Net Core due to following:
- MSBuild is one of the main components of the ecosystem of .Net tools. Scripts, VS Extensions and tools targeting MSBuild should be extended to work with the .Net Core.
- It is possible to add project to project references with the help of MSBuild. All .Net projects make use of MSBuild; hence making a switch to MSBuild will allow programmers to reference PCL (portable Class Libraries) from the projects of .Net Core the libraries from the projects of .Net framework.
- MSBuild is scalable and capable of creating large size projects. As the adoption of .Net Core will increase, a build system is the main requirement to count on.
The transition to csproj from project.json is also important. The following are not changed.
- The project file consists of dependency and the information about target framework in one single file. By default, no source files have been listed.
- Frameworks are targeted by .Net Core and the dependencies of metapackage remain the same. They are declared similar to the csproj format.
- The commands exposed by the dotnet tools are same such as dotnet run and dotnet build.
- Templates can be easily created by dotnet new command.
- The new tools are used for targeting .Net Core 1.1 and 1.0 version.
Install Visual Studio 2017 from the site of Visual Studio. Install the tools of .Net Core of visual Studio version 2017 RC by clicking on the option of .Net Core and Docker tools in workloads under the workload of Web and Cloud as shown below:
Create New Projects
The templates of projects on .Net Core can be found in the node of .Net Core in Visual Studio as shown below:
References among Project to Project:
Projects of .Net Standard can be referenced from Xamarin, .Net Framework as well as UMP projects.
Managing References of Nuget Package:
The references of Nuget package can be managed with the help of Nuget Package Manager. In the below figure, package of NewtonSoft.Json is added in project.
Dynamic Project System:
The format of csproj file will by default add all the source files. There is no need to list every .cs file. It can be seen in action after addition of .cs file in project directory from the outside of Visual Studio. The .cs file will be added in the Solution Explorer in few seconds.
Many benefits are offered by a minimal project such as reliability. It helps in reduction of many changes in source control along with the merge conflicts.
Open And Upgrade project.json:
There will be a prompt for up gradation of projects based on project.json to csproj projects when these are opened in Visual Studio 2017. Look at the below figure. The migration of projects is one-way. There is no way of going back to project.json except from the backups or the source control.
Visual Studio for MAC
Visual Studio for MAC is basically a new family member of Visual Studio. It is focused on the cross-platform development of cloud and mobile on the mac. It supports Xamarin as well as .Net Core projects.
To create a new project, go to the .Net Core node of the Visual Studio.
XProj migration is not supported is not supported by the Visual Studio for MAC. The same can be added before the release. However, it supports the updation of csproj files when project is loaded. The csproj file can be opened by right clicking on project file, then select Tools and then select on Edit file.
.Net Core CLI Tools:
The tools of .Net Core CLI have been updated. They are now created on MSBuild top and expect the project files of csproj type. All logic that was written to process project.json files is removed. The CLI tools have now become simple and heavily depend on MSBuild.
When the project for upgrading CLI tools was started, the purpose of CLI tools was considered since MSBuild itself is a commandline tool that has its own ecosystem, command line syntax and history. It was concluded that there is a requirement of intuitive and simple tools that will make the adoption of .Net Core easier.
The new tools of .Net Core can be installed by installing the SDK of Preview3 .Net Core. It can be used with both .Net Core 1.1 and 1.0 version.
Side by Side Install:
There will be an update of dotnet command’s default behavior after the new SDK is installed. They will make use of csproj and MS build projects rather than the project.json projects. Similarly, a profile file of csproj will be created by the dotnet new command.
To continue to make use of the tools based on project.json, add the file of project.json to project directory and then add sdk property in it.
Dotnet new command can be used to create a new project. It provides support of multiple project files using –t argument. Following is the list of templates supported by –t library.
Upgrade Project.Json Projects:
Dotnet migrate command is used for migration of projects from project.json to csproj type. Any project to project reference will be automatically migrated by this command.
You can run the latest release tools of .net core in both .net core 1.1 and 1.0 versions. For any further assistance, write to custom asp.net development services provider. You can even share your reviews for this post in comments.