Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I define "dependencies" and "frameworkAssemblies" in project.json when targeting "dotnet"

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.

like image 511
Dealdiane Avatar asked Feb 01 '26 07:02

Dealdiane


1 Answers

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.

like image 145
Dealdiane Avatar answered Feb 03 '26 07:02

Dealdiane