Frameworks and imports sections in project.json: w

2019-04-21 03:25发布

问题:

What exactly are the frameworks and imports sections of the project.json file of a ASP.NET Core 1.0 project and what do they do? I've been trying to find "official" documentation to understand it better.

Here's a boilerplate example from a recent Yeoman-scaffolded ASP.NET project I started up:

"frameworks": {
  "netcoreapp1.0": {
    "imports": [
      "dotnet5.6",
      "dnxcore50",
      "portable-net45+win8"
    ]
  }
},

回答1:

  • frameworks is the list of target frameworks that you application supports.
  • imports is a way to use packages that were not designed for that framework. Basically you tell it "Use those targets even though they don't seem to be supported. I know what I'm doing".

Here's a gist that might give you more insights into how various TFMs (Target Framework Monikers) map to each other https://gist.github.com/davidfowl/8939f305567e1755412d6dc0b8baf1b7