简体   繁体   中英

Unable to add any nuget dependency with ASP.NET 5

I've just downloaded Visual Studio Enterprise 2015 RC and I'm trying to create a simple ASP.NET 5 application. But each time i'm modifying the project.json to add a dependency, I always have an error. For example, when adding a dependency to Newtonsoft.Json I have :

"Dependency Newtonsoft.Json >= 6.0.8 could not be resolved

I've tried to remove the dnxcore50 framework, but nothing better.

What am I missing ?

See project.json

{
  "webroot": "wwwroot",
  "version": "1.0.0-*",

  "dependencies": {
    "Microsoft.AspNet.Mvc": "6.0.0-beta4",
    "Microsoft.AspNet.Server.IIS": "1.0.0-beta4",
    "Microsoft.AspNet.Server.WebListener": "1.0.0-beta4",
    "Microsoft.AspNet.StaticFiles": "1.0.0-beta4",
    "Newtonsoft.Json": "6.0.8"
  },

  "commands": {
    "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000"
  },

  "frameworks": {
    "dnx451": { }
  },

  "exclude": [
    "wwwroot",
    "node_modules",
    "bower_components"
  ],
  "publishExclude": [
    "node_modules",
    "bower_components",
    "**.xproj",
    "**.user",
    "**.vspscc"
  ]
}

EDIT : Nuget.config is :

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <packageSources>
    <add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
  </packageSources>
  <disabledPackageSources>
    <add key="nuget.org" value="true" />
  </disabledPackageSources>
  <activePackageSource>
    <add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
  </activePackageSource>
</configuration>

EDIT 2 : If I use this, it's working :

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <activePackageSource>
    <add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
  </activePackageSource>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
</configuration>

Here's the problem:

<disabledPackageSources>
    <add key="nuget.org" value="true" />
</disabledPackageSources>

The nuget.org source is disabled

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM