Frameworks and imports sections in project.json: what are they?
Asked Answered
W

1

10

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"
    ]
  }
},
Withdrawn answered 19/5, 2016 at 14:26 Comment(0)
K
7
  • 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

Kleeman answered 19/5, 2016 at 16:19 Comment(4)
Quite often, I feel I don't know what I'm doing, and adding a new item to the imports just seems like black magic or that I may be incurring downstream technical debt somehow. For example, if I am developing on OSX for deployment to Linux via Docker, do I need to consider the implications of adding a new item to imports just to get a compatibility error to go away?Withdrawn
Actually the import itself is technical debt from the MS team. In multiple ways. import is used for three scenarios right now: Smoothening the transition from dnxcore50 to netstandard1.5, smoothening the transition from the two or three portable profiles which perfectly match into netstandard1.x and to avoid a dependency disaster because third-party libraries are not updated yet to netstandard.Deafen
Sounds like the right thing to do is to grit the teeth, light up the imports clause like a Christmas tree, and carry on as if everything was completely normal. ;-)Withdrawn
What should i keep inside imports if i want develop Class Library Project on my MAC and use it for Windows System ASP.NET App ?Disdainful

© 2022 - 2024 — McMap. All rights reserved.