BT

.NET Core Tools Switch to MSBuild

| by Jeff Martin Follow 17 Followers on Nov 30, 2016. Estimated reading time: 1 minute |

The desire for .NET Core and ASP.NET Core to comfortably support platforms beyond Visual Studio running on Windows led Microsoft to create a project system based on project.json format.  Unfortunately, this new format led to incompatibility with the previous system based on .csproj/MSBuild.  Microsoft's Rich Lander has announced that the .NET Core tools will be migrating to the MSBuild format in a new alpha release.

Since developers using .NET Core today already rely on the project.json format, Microsoft has built a migration tool (invokable via dotnet migrate) which is designed to convert these files to the MSBuild format.

This change in format provides many helpful benefits, including:

  • Project to project references now work – References can be made between existing .NET Standard based projects (.NET Framework, Xamarin, or UWP) and .NET Core.
  • Project and NuGet references are declared similarly, both in csproj – Packages added via NuGet are properly referenced in the csproj file.
  • csproj project files can be manually edited while the project is open – Microsoft doesn’t see this as a day-to-day task, but editing csproj files in Visual Studio with IntelliSense support is possible.

When opening project.json based projects in VS2017RC (or newer), a dialog will appear prompting for confirmation to begin a one-way conversion to the .csproj format.  Do note that this in fact a one-way process, so be sure to have backups are made before proceeding.  Those developers using the .NET Core CLI Tools will find that they have also been updated to use the MSBuild-based system. 

Lander notes that this release of the Core Tools is considered an alpha release, and should be treated as such.  The tools are available for download on all .NET Core supported platforms (Windows, macOS, and Linux).

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Welcome back to csproj hell! by Piotr Owsiak

MS promised a lightweight project definition and did not deliver and we can expect those nasty XML merges again I guess. I suppose the marketing message was out and people already bought it. Also the whole .NET Core being not stable solution yet makes the whole .NET tool ecosystem lag behind and be ready for serious development yet. My experience is that it's a lot of pain when tools like R# and NCrunch are not working well or at all with .NET Core, well even Visual Studio is not working very well with .NET Core so my suggestion is to postpone any investment plans for a while before things settle and MS stops making big impact changes to the platform.

Re: Welcome back to csproj hell! by Victor Mingueza

Hi Piotr, they simplified the csproj file, so you won't have those conflicts on merging anymore. Take a look here blogs.msdn.microsoft.com/dotnet/2016/11/16/anno... on the section 'Editing CSProj files'

Re: Welcome back to csproj hell! by Piotr Owsiak

Hi Victor,

I'm well aware of that, and I've actually read the post you linked to and if you see the "Dynamic Project system" section they talk about .cs files which is only part of the problem and that's why I'm claiming we're going back to XML merge hell in my previous comment. The reason for that is because for instance my web projects are not only .cs files and I get XML merge conflicts not only on .cs project items so until MS confirms that you don't have to list any files at all I will stand by my previous statement.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

3 Discuss
BT