Updating Visual Studio 2017 RC – .NET Core Tooling improvements

This post was co-authored by Joe Morris, a Senior Program Manager on the .NET Team and David Carmona, a Principal Program Manager Lead on the .NET Team.

Today, an update to Visual Studio 2017 RC was announced. As part of this update, we have made several enhancements and bug fixes to the .NET Core tools that are part of Visual Studio 2017. For previous information about these tools you can read our original blog post announcing the initial RC release of Visual Studio 2017.

Summary

This update contains many enhancements and bug fixes to the early alpha we released with Visual Studio 2017 RC. Despite this great progress, it is still a preview. For an up to date list of issues that we are working on, please see our GitHub page. The top areas addressed in this update are:

  • csproj file simplification: .NET Core project files now use an even more simplified syntax, making them easier to read. Also, csproj file editing in the IDE has been improved.
  • CLI commands added: New commands added for adding (add p2p) and removing (remove p2p) project to project references.
  • Overall quality improved: Bug fixes in xproj to csproj migration, project to project references, NuGet, MSBuild and ASP.NET Core with Docker.

csproj file simplification

.NET Core csproj files have been simplified, making them easier to read. Snippets shown below demonstrate the simplification.

.NET Core Console application

Previous:

Simplified:

ASP.NET Core Web application

Previous:

Simplified:

As you can see, it is lot more shorter and easier to read. Note: A few of the simplifications to the project files are not included in the update that we are making available today, but we plan to include them in a later update.

In the simplified csproj syntax, notice that the SDK is no longer a package reference, instead it is now a project attribute. This attribute signifies the set of tooling which defines the type of the project and is used to build and run it.

In the early alpha release, the SDK was a NuGet package that had to be restored before a .NET Core or ASP.NET Core project could be used.  Now, we preinstall the tooling when you install Visual Studio 2017 RC with the “.NET Core and Docker (Preview)” workload, and it is consumed directly by MSBuild without requiring a package restore.

We are investigating further improvements to the SDK attribute feature, such as support for third party SDKs and specifying which version of an SDK is required.

In addition to the simplification of csproj syntax, we also fixed two major annoyances that were present in the early alpha release:

  • Squiggles in csproj file don’t show up anymore when you open the newly created csproj file created using IDE or CLI.

  • When editing a csproj project file, changes made through the UI (solution explorer, package manager etc.) are reflected in the open editor.

Upgrading from RC

Project templates used by Visual Studio and .NET CLI to create new .NET Core or ASP.NET Core projects now use the simplified csproj syntax. However, there is no auto conversion from the previous RC csproj syntax to the new simplified syntax. If you created .NET Core or ASP.NET Core projects using the previous release of Visual Studio 2017 RC, then you need to update the csproj file to the simplified syntax by hand editing the project file. Please refer to Release Notes to on how to do this, where clear examples are explained.

CLI enhancements

  • Added the dotnet add p2p command, for adding project to project references.
  • Added the dotnet remove p2p command, for removing project to project references from the project file.
  • dotnet new templates are updated to reflect the simplified csproj syntax.
  • Added verbosity control to build, pack, publish, restore & test using –v | –verbosity. The verbosity levels map to MSBuild verbosity levels.

Bug fixes

  • Migration from xproj to csproj
    • Migration of projects that have P2P references is no longer broken.
    • Removed PostPublishScript target.
    • Removed post-migration reference to dotnet-test-mstest.
    • Fixed migration output issues.
    • Migration adds RIDs when migrating projects with .NET Framework TFM.
    • Migration no longer migrates the reference to dotnet-test-xunit if project.json contains it.
  • Project to Project References
    • Referencing from a UWP project is no longer blocked.
    • Referencing from regular csproj no longer gives warnings.
    • TargetFramework dropdown in the project properties page works.
  • NuGet
    • Restore hang fixes and stability improvements.
    • Pack now uses the correct version range for dependency projects.
    • Restore now adds correct project dependency version for command line restore.
  • MSBuild
    • Improvement to incremental builds for C# and VB projects that use wildcards that ensures a rebuild when a source file is deleted.
  • ASP.NET Core Tooling
    • Entity Framework Core commands such as Add-Migration and Update-Database can now be invoked using NuGet Package Manager Console.
    • To successfully restore Bower packages, you no longer need to have Git installed globally or manually reference Git in Tools-Options.
    • Can successfully debug ASP.NET Core Web Applications with Windows Authentication.
  • Docker
    • When provisioning an Azure Docker registry and App Service plan, it no longer requires a new resource group to be created in the same region as the App Service plan.
    • Improved the usability of creating a new Azure resource group.

Thanks for trying out this latest update of Visual Studio 2017! We’re continuing to iterate on the release candidate and will post more updates, so we definitely want your feedback. For problems, let us know via the Report a Problem option in the upper right corner of the VS title bar. Track your feedback on the developer community portal. For suggestions, let us know through UserVoice.

Known Issues

For an up to date list of .NET Core and ASP.NET Core tooling known issues, please see our GitHub page.