3

Based on this, basically what I understand is that, assuming the dependency lib comes preinstalled with the framework I should use frameworkAssemblies but if it isn't, in which case it needs to be pulled down by a package manager source and you're supposed to use dependencies.

My question is if I target dotnet which is basically “I’m compatible with any targets that my dependencies are, check those.”, how should I define a reference to System.Threading.Tasks for example?

If I put a

"frameworks": {
    "dotnet": {
      "dependencies": {
        "System.Threading.Tasks": "4.0.10"
      }
   }
}

would that mean that when running against the full .NET framework, it'll use the bundled library and not the one from GAC?

and if I use

"frameworks": {
    "dotnet": {
      "frameworkAssemblies": {
        "System.Threading.Tasks": "4.0.10"
      }
   }
}

would that mean that if I publish my website, it wouldn't include the System.Threading.Tasks package?

UPDATE: I feel like I'm getting myself confused here. When I tried

"dependencies": {
    "EntityFramework.SqlServer": "7.0.0-beta7"
},

"frameworks": {
    "dotnet": { }
}

I would've expected it to compile. The target frameworks would've been limited to whatever the target of "EntityFramework.SqlServer" (net45, dnxcore50) is. This doesn't work however and I'm getting a The dependency EntityFramework.SqlServer 7.0.0-beta7 in project xxx does not support framework .NETPlatform,Version=v5.0 error instead. It looks like using dotnet is a moniker for targeting BCL only.

Community
  • 1
  • 1
Dealdiane
  • 3,984
  • 1
  • 24
  • 35
  • I think because often you need dependencies for dnxcore50 that correspond to framework assembles in dnx451 you should not use dotnet as a target but instead use dnx451 and dnxcore50 so that the dependencies for each can be set independently. I don't know much about the target dotnet, in an early beta vs class library project template used that for target but if you make a class library project with newer beta7 tooling you now get dnx451 and dnxcore50 as targets and I think that is what you should use. – Joe Audette Sep 17 '15 at 00:44
  • The thing is `dotnet` is supposedly what you'd use so that you don't have to explicitly specify what your target frameworks are. Your dependencies would implicitly define them or I probably just don't understand how it's supposed to work exactly. – Dealdiane Sep 17 '15 at 01:59

1 Answers1

2

Based on what I found out by trying different project.json combinations, it turns out that dotnet may just be a moniker for the .NET platform itself so to answer my question, I think the way to do it is by:

"net45": {
    "frameworkAssemblies": {
        ...
    }
},
"dnx451": {
    "frameworkAssemblies": {
        ...
    }
},
"dotnet": {
    "dependencies": {
        ...
    }
}

This contradicts what targeting dotnet is supposed to fix though? I hope someone from the team would shed some light about this.

Dealdiane
  • 3,984
  • 1
  • 24
  • 35