Context
Before Visual Studio 2017 was released, I was implementing my ASP.NET Core project using VS2015. TFS2015 is used for Continuous Build and Deployment for my projects.
After migrating to VS2017, there are couple of issues I encountered in my environment:
- VS2017 has abounded the JSON project file format.
- Dotcore tools’ versions in Visual Studio Team Service are different in different agents.
This page summarizes the steps you need to do to resolve these issues.
Hosted VS2017 Agent
Based on the following documentation, you need to use Hosted VS2017 agent for VS2017 projects build since the project file format is now different:
https://www.visualstudio.com/en-au/docs/build/steps/build/msbuild
Team Services and Team Foundation Server 2017: If your team uses Visual Studio 2017 and you want to use our hosted agents, make sure you select as your default queue the Hosted VS2017. See Hosted agents.
If you don’t do this, the dotnet core CLI will still look for project.json files, which can lead to errors like the following:
Couldn't find 'project.json' in 'C:\a\1\s\src\****’
dotnet core CLI changes
Previously, you can run dotnet core commands using folder path as argument.
dotnet restore $foldername
However, with VS2017, you can specify the actual project file name:
dotnet restore src\mywebsite.csproj
Otherwise you may meet the following issue:
warn : The folder 'C:\a\1\s\src' does not contain a project to restore.
Further more, you may encounter many related compiling issues as all the packages referenced are not restored successfully.
Program.cs(10,18): error CS0518: Predefined type 'System.Object' is not defined or imported …