Blog
Error on start after ASP.NET Core project upgraded from Visual Studio 2015 to Visual Studio 2017 RC
After upgrading an ASP.NET Core Web Application project from Visual Studio 2015 to the new Visual Studio 2017 RC, I got an error on every start before Program.Main was hit, with a dialog showing the error message:
Object reference not set to an instance of an object.
Once I clicked the OK button, the execution continued and Program.Main was called normally.
The problem is a bug in the upgrade tools of Visual Studio 2017 RC, which doesn't handle a change in the format of the Properties/launchSettings.json file.
In Visual Studio 2015, this file looks like this:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:15174/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"WebApplication2": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5000/home",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
In Visual Studio 2017 RC, you have to add the applicationUrl node to your profile. It becomes:
"WebApplication2": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "home",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
"applicationUrl": "http://localhost:15174"
}
16/12/2016