2015-11-04 52 views
6

我想Newtonsoft.json金塊包添加到我的項目,並獲得在編譯下面的錯誤,VS 2015年「依賴無法解析」關於vNext項目編譯錯誤

「NU1001的依賴Newtonsoft.Json > = 7.0.1無法解決。「

它工作正常,如果我安裝包版本< = 6.0.6。我也嘗試從項目的根文件夾中的powershell運行dnu restore(顯然是爲其他人工作)。同樣的錯誤。還嘗試通過Nugget管理器進行安裝,並直接在project.json中添加包名,並讓VS自行恢復。

我想建立在dnx451框架beta8版本上。

是否有任何默認的框架依賴關係需要6.0.6版本?如果是這樣,是否有任何解決方法。我有其他項目需要最新的金塊包,並從vNext項目引用時引發引用不匹配錯誤。

感謝任何幫助!

+0

蝙蝠俠,請加你留在答案的評論下面作爲一個答案。這爲我解決了這個問題,也會對其他訪問者有所幫助。謝謝。 – NoSaidTheCompiler

+0

[使我的評論作爲答案,因爲這似乎已爲其他人](http://stackoverflow.com/questions/33532247/vs-2015-dependency-could-not-be-resolved-error-on-vnext-project -compilation?noredirect = 1個#comment54882293_33548292)。 – iambatman

回答

1

您可以包含Newtonsoft.json 7.0.1。也許你的project.json有問題。

這是我的project.json。

{ 
"webroot": "wwwroot", 
"userSecretsId": "aspnet5-GGZDBC5-d96c66a6-1a4e-4a9a-b8d4-11c2f88ff638", 
"version": "1.0.0-*", 
"dependencies": { 
    "CsvHelper": "2.13.1", 
    "EntityFramework.Commands": "7.0.0-beta8", 
    "EntityFramework.SqlServer": "7.0.0-beta8", 
    "Microsoft.ApplicationInsights.AspNet": "1.0.0-beta8", 
    "Microsoft.AspNet.Authentication.Cookies": "1.0.0-beta8", 
    "Microsoft.AspNet.Authentication.Facebook": "1.0.0-beta8", 
    "Microsoft.AspNet.Authentication.Google": "1.0.0-beta8", 
    "Microsoft.AspNet.Authentication.MicrosoftAccount": "1.0.0-beta8", 
    "Microsoft.AspNet.Authentication.Twitter": "1.0.0-beta8", 
    "Microsoft.AspNet.Diagnostics": "1.0.0-beta8", 
    "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta8", 
    "Microsoft.AspNet.Http": "1.0.0-beta8", 
    "Microsoft.AspNet.Http.Features": "1.0.0-beta8", 
    "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta8", 
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-beta8", 
    "Microsoft.AspNet.Mvc": "6.0.0-beta8", 
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta8", 
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-beta8", 
    "Microsoft.AspNet.Server.WebListener": "1.0.0-beta8", 
    "Microsoft.AspNet.StaticFiles": "1.0.0-beta8", 
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-beta8", 
    "Microsoft.Framework.Configuration.Abstractions": "1.0.0-beta8", 
    "Microsoft.Framework.Configuration.Json": "1.0.0-beta8", 
    "Microsoft.Framework.Configuration.UserSecrets": "1.0.0-beta8", 
    "Microsoft.Framework.Logging": "1.0.0-beta8", 
    "Microsoft.Framework.Logging.Console": "1.0.0-beta8", 
    "Microsoft.Framework.Logging.Debug": "1.0.0-beta8", 
    "Microsoft.Framework.SecretManager": "1.0.0-beta8", 
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta8", 
    "Newtonsoft.Json": "7.0.1-*", 
    "Mvc6.JQuery.Datatables": "1.0.0-*", 
    "npm": "1.4.15.2", 
    "TagHelpers": "1.0.0-*" 
}, 
"commands": { 
    "web": "Microsoft.AspNet.Server.Kestrel", 
    "ef": "EntityFramework.Commands" 
}, 
"frameworks": { 
    "dnx451": { 
     "dependencies": { 
      "DataTables": "1.0.0-*", 
     }, 
     "frameworkAssemblies": { 
      "System.Web": "4.0.0.0" 
     } 
    } 
}, 
"exclude": [ 
    "wwwroot", 
    "node_modules" 
], 
"publishExclude": [ 
    "**.user", 
    "**.vspscc", 
    "Metronic" 
], 
"scripts": { 
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ] 
} 
} 

這是我DNU恢復結果

c:\git\DBC\src\DBC>dnu restore 
Microsoft .NET Development Utility Clr-x86-1.0.0-beta8-15858 

CACHE https://www.myget.org/F/aspnetrelease/api/v3/index.json 
CACHE http://www.myget.org/F/azureadwebstacknightly/api/v3/index.json 
CACHE https://api.nuget.org/v3/index.json 
Restoring packages for c:\git\DBC\src\DBC\project.json 
GET  https://www.myget.org/F/aspnetrelease/api/v3/flatcontainer/newtonsoft.json/index.json 
GET  https://www.myget.org/F/azureadwebstacknightly/api/v3/flatcontainer/newtonsoft.json/index.json 
CACHE https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json 
NotFound  https://www.myget.org/F/aspnetrelease/api/v3/flatcontainer/newtonsoft.json/index.json 359ms 
NotFound  https://www.myget.org/F/azureadwebstacknightly/api/v3/flatcontainer/newtonsoft.json/index.json 1406ms 
Writing lock file c:\git\DBC\src\DBC\project.lock.json 
Restore complete, 3216ms elapsed 

NuGet Config files used: 
C:\Users\Thom\AppData\Roaming\NuGet\nuget.config 

Feeds used: 
https://www.myget.org/F/aspnetrelease/api/v3/flatcontainer/ 
https://www.myget.org/F/azureadwebstacknightly/api/v3/flatcontainer/ 
https://api.nuget.org/v3-flatcontainer/ 
+10

感謝您的回覆!我的project.json lokos很好。 dnu restore並沒有在這個提要https://www.nuget.org/api/v2/中尋找這個軟件包,但是隻有myget源。我剛剛刪除了AppData \ Romaing \ Nuget文件夾中的nuget.config,並且在再次恢復軟件包時創建了一個新的文件。現在工作正常。奇怪的! – iambatman

+1

@iambatman您的評論爲我工作。你應該回答你自己的問題並接受它。 – daramasala

+0

做到這一點,蝙蝠俠!因爲這個,我失去了幾個小時。 –

相關問題