December 2016 Entries

This has been annoying me for a while, but as usual the solution was simple. It turns out Visual Studio 2015 removes some key entries form project.json when you update Microsoft.NETCore.App using NuGet Package Manager.

Before updating to Microsoft.NETCore.App v1.1.0 project.json:

{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},

"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
}
},

"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
}
}

After updating to Microsoft.NETCore.App v1.1.0 project.json:

{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},

"dependencies": {
"Microsoft.NETCore.App": "1.1.0"
},

"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
}
}

Which causes the error:

Can not find runtime target for framework '.NETCoreApp,Version=v1.0' compatible with one of the target runtimes: 'win10-x64, win81-x64, win8-x64, win7-x64'.

So to fix it just add the missing bits back into project.json:

{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},

"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.1.0"
}
},

"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
}
}

#