While upgrading several projects to Visual Studio 2017 I was caught out by three gotchas: I was unable to push changes to remote Git repositories, I had ASP.NET Core applications failing under both Kestrel and IIS Express, and I had ASP.NET Core projects that stopped working under Visual Studio 2015.
This post documents these three issues and provides the solutions I used to work around them.
Gotcha #1: Unable to push changes to remote Git repositories
Update (9th April 2017): As of update 15.1 (26403.0) to Visual Studio, this solution to this gotcha no longer works for me. I've posted a new solution that does.
When trying to push changes to a remote Git repository from VS2017 it failed with the following error:
Error encountered while pushing to the remote repository: Git failed with a fatal error.
PushCommand.ExecutePushCommand
The solution, which was part of this Stack Overflow answer, was to delete this folder:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git
Remember to make a backup before deleting the folder, in case you need to restore it or the issue is not resolved.
Depending on your existing setup, you may also need to install the latest version of Git and add it to your system path environment variable.
Gotcha #2: ASP.NET Core applications failing on both Kestrel and IIS Express
When trying to run an ASP.NET Core application under Kestrel it failed with the exception System.DllNotFoundException: Unable to load DLL 'libuv'
and when run under IIS Express it failed with an HTTP Error 502.5 - Process Failure
.
It turns out this occurs when the platform target is set to Any CPU
and you are targeting the .NET Framework as opposed to .NET Core.
The solution is to explicitly set the target to either x86
or x64
. To change the platform target, right click on the project in solution explorer, goto Project Properties
, then to the Build
tab, and finally change the Platform target from Any CPU
to either x86
or x64
.
It looks like this problem might result from the native assets not getting copied into bin
correctly when the Platform target is set to Any CPU
. See this old issue and track its progress on this issue.
Gotcha #3: ASP.NET Core projects break under Visual Studio 2015
After installing Visual Studio 2017, you might find that some ASP.NET Core projects no longer compile in Visual Studio 2015 and produce an error dialog containing:
The following error occurred attempting to run the project model server process (1.0.0-preview3-004056).
Unable to start the process. No executable found matching command "dotnet-projectmodel-server"
The project model server process provides intellisense, build, and reference information to Visual Studio and without it your experience will be very limited. Please try closing and reopening Visual Studio to see if that corrects the problem. Alternatively, check that the .NET Core SDK is properly installed.
The solution, as pointed out in this Stack Overflow answer, is to add a global.json
file to the root of your ASP.NET Core project with the following contents:
{
"projects": [],
"sdk": {
"version": "1.0.0-preview2-003131"
}
}
When you upgrade the project to Visual Studio 2017, you can delete the global.json
file.