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"
    ]
  }
},
robbpriestley
  • 3,050
  • 2
  • 24
  • 36

1 Answers1

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

Victor Hurdugaci
  • 28,177
  • 5
  • 87
  • 103
  • 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? – robbpriestley May 19 '16 at 16:28
  • 1
    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. – Thomas May 19 '16 at 20:31
  • 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. ;-) – robbpriestley May 20 '16 at 15:45
  • 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 ? – Sumeet Gohil Feb 09 '17 at 06:09