.net - Solving error "Microsoft.NETCore.App 1.0.0 does not support framework .NETFramework,Version=v4.6.1" -


i have asp.net core 1.0 complete application running using net461 references. trying add framework - netcoreapp1.0. this, have updated project.json this:

{    "usersecretsid":"",    "version":"2.4.0-*",    "buildoptions":{       "emitentrypoint":true,       "preservecompilationcontext":true    },    "dependencies":{       "microsoft.applicationinsights.aspnetcore":"1.0.0",       "microsoft.aspnetcore.authentication.cookies":"1.0.0",       "microsoft.aspnetcore.diagnostics":"1.0.0",       "microsoft.aspnetcore.diagnostics.entityframeworkcore":"1.0.0",       "microsoft.aspnetcore.identity":"1.0.0",       "microsoft.aspnetcore.identity.entityframeworkcore":"1.0.0",       "microsoft.aspnetcore.mvc":"1.0.0",       "microsoft.aspnetcore.mvc.taghelpers":"1.0.0",       "microsoft.aspnetcore.server.iisintegration":"1.0.0",       "microsoft.aspnetcore.server.kestrel":"1.0.0",       "microsoft.aspnetcore.staticfiles":"1.0.0",       "microsoft.entityframeworkcore":"1.0.0",       "microsoft.entityframeworkcore.sqlserver":"1.0.0",       "microsoft.extensions.configuration.commandline":"1.0.0",       "microsoft.extensions.configuration.fileextensions":"1.0.0",       "microsoft.extensions.configuration.json":"1.0.0",       "microsoft.extensions.configuration.usersecrets":"1.0.0",       "microsoft.extensions.logging":"1.0.0",       "microsoft.extensions.logging.console":"1.0.0",       "microsoft.extensions.logging.debug":"1.0.0",       "microsoft.visualstudio.web.browserlink.loader":"14.0.0",       "microsoft.visualstudio.web.codegenerators.mvc":"1.0.0-preview2-final"    },    "tools":{       "bundlerminifier.core":"2.0.238",       "microsoft.aspnetcore.razor.tools":"1.0.0-preview2-final",       "microsoft.aspnetcore.server.iisintegration.tools":"1.0.0-preview2-final",       "microsoft.extensions.secretmanager.tools":"1.0.0-preview2-final"    },    "commands":{       "ef":"entityframework.commands",       "web":"microsoft.aspnetcore.server.kestrel"    },    "frameworks":{       "net461":{        },       "netcoreapp1.0":{          "imports":[             "dotnet5.6",             "portable-net45+win8"          ]       }    },    "runtimes":{       "win10-x64":{        },       "win81-x64":{        },       "win8-x64":{        },       "win7-x64":{        }    },    "publishoptions":{       "exclude":[          "**.user",          "**.vspscc",          "wwwroot",          "node_modules"       ]    },    "scripts":{       "prepublish":[          "npm install",          "bower install",          "gulp clean",          "gulp min"       ]    } } 

after modifying project.json, got error:

failed make following project runnable: mvc6_full_version (.netcoreapp,version=v1.0) reason: expected coreclr library not found in package graph. please try running dotnet restore again.

to resolve this, ran dotnet restore command no luck.

then, added block:

"microsoft.netcore.app": {   "version": "1.0.0",   "type": "platform" }, 

after adding block, got different error:

code: nu1002 description: dependency microsoft.netcore.app 1.0.0 not support framework .netframework,version=v4.6.1.

basically, want add both references in applications - .net framework 4.6.1 , asp.net core 1.0.

how resolve error?

it's possible build asp.net core projects using .net framework or .net core. you're close - few tweaks needed:

  • remove runtimes section, unless intending native compilation (somewhat unusual)
  • place reference microsoft.netcore.app in dependencies section inside netcoreapp1.0 section. i've tested following change , restores , compiles without errors:

project.json

...     "frameworks": {       "net461": {        },       "netcoreapp1.0": {          "dependencies": {             "microsoft.netcore.app": {                "type": "platform",                "version": "1.0.0"             }          },          "imports": [             "dotnet5.6",             "portable-net45+win8"          ]       }    } 

the microsoft.netcore.app dependency required .net core, , adding here make sure it's available when building framework.

also, commands section has been deprecated , can removed.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -