2016-01-24 15 views
0

對此有何想法?dnx ef migrations添加初始dnx:System.ArgumentNullException:值不能爲空

我project.json

{ 
    "userSecretsId": "aspnet5-WebApplication1-c5682a65-7af3-447d-a812-9b4838ea33be", 
    "version": "1.0.0-*", 
    "compilationOptions": { 
    "emitEntryPoint": true 
    }, 

    "dependencies": { 
    "EntityFramework.Commands": "7.0.0-rc1-final", 
    "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final", 
    "Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final", 
    "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final", 
    "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final", 
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final", 
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final", 
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final", 
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final", 
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final", 
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final", 
    "Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Configuration.FileProviderExtensions" : "1.0.0-rc1-final", 
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Logging": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final", 
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final", 
    "Microsoft.Extensions.DependencyInjection": "1.0.0-rc1-final" 
    }, 

    "commands": { 
    "web": "Microsoft.AspNet.Server.Kestrel", 
    "ef": "EntityFramework.Commands" 
    }, 

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

    "exclude": [ 
    "wwwroot", 
    "node_modules" 
    ], 
    "publishExclude": [ 
    "**.user", 
    "**.vspscc" 
    ], 
    "scripts": { 
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ] 
    } 
} 

得到的錯誤,當我嘗試運行遷移步驟

PM> dnx ef migrations add Initial 
dnx : System.ArgumentNullException: Value cannot be null. 
At line:1 char:1 
+ dnx ef migrations add Initial 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (System.Argument...cannot be null.:String) [], RemoteException 
    + FullyQualifiedErrorId : NativeCommandError 

Parameter name: appEnv 
    at Microsoft.Data.Entity.Utilities.Check.NotNull[T](T value, String parameterName) 
    at Microsoft.Data.Entity.Commands.Program..ctor(IServiceProvider serviceProvider, IApplic 
ationEnvironment appEnv, ILibraryManager libraryManager, IRuntimeEnvironment runtimeEnv) 

這是我dnvm名單:

PM> dnvm list 

Active Version   Runtime Architecture Location     Alias 
------ -------   ------- ------------ --------     ----- 
     1.0.0-beta5  clr  x64   C:\Users\user\.dnx\runtimes   
     1.0.0-beta5  clr  x86   C:\Users\user\.dnx\runtimes   
     1.0.0-beta5  coreclr x64   C:\Users\user\.dnx\runtimes   
     1.0.0-beta5  coreclr x86   C:\Users\user\.dnx\runtimes   
     1.0.0-rc1-update1 clr  x64   C:\Users\user\.dnx\runtimes   
     1.0.0-rc1-update1 clr  x86   C:\Users\user\.dnx\runtimes default 
    * 1.0.0-rc1-update1 coreclr x64   C:\Users\user\.dnx\runtimes   
     1.0.0-rc1-update1 coreclr x86   C:\Users\user\.dnx\runtimes   

我是通過走這個,但到目前爲止,這個新的ASP.NET看起來非常麻煩。 http://docs.asp.net/en/latest/tutorials/your-first-aspnet-application.html

更新

DNU建立輸出

Build succeeded. 
    0 Warning(s) 
    0 Error(s) 

Time elapsed 00:00:01.3991506 
Total build time elapsed: 00:00:01.4070482 
Total projects built: 1 
PM> 

和DNU恢復

PM> dnu restore 
Microsoft .NET Development Utility CoreClr-x64-1.0.0-rc1-16231 

    CACHE https://www.nuget.org/api/v2/ 
Restoring packages for G:\Projectos\Tests\projx\project.json 
    GET https://www.nuget.org/api/v2/FindPackagesById()?id='System.Threading.ThreadPool' 
    OK https://www.nuget.org/api/v2/FindPackagesById()?id='System.Threading.ThreadPool' 722ms 
Writing lock file G:\Projectos\Tests\projx\project.lock.json 
Restore complete, 3023ms elapsed 

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

Feeds used: 
    https://www.nuget.org/api/v2/ 
PM> 
+0

作爲3k代表用戶,您至少應該已經學會了如何發佈適當的問題。不是嗎? – Rahul

+0

所以你做了DNU構建步驟,沒有問題?而你的DNU恢復同樣沒有問題? – NovaDev

+0

我認爲你的版本是錯誤的。你的默認顯示爲clr,即使活動是coreclr。嘗試明確地告訴dnvm/dnu/dnx使用你的活動運行時 - 'dnvm exec 1.0.0-rc1-update1 dnu build'或者更新你的-a標誌來使用x86而不是x64 ... – NovaDev

回答

-1

移動我的評論的回答實際的答案(和清潔它一點) - 看起來版本是錯誤的。默認顯示爲clr,即使活動版本是coreclr。在這種情況下,我建議明確告訴dnvm/dnu/dnx使用活動運行時與活動拱適用於各種構建命令,例如:dnvm exec 1.0.0-rc1-update1 -r coreclr dnu build並且可能還會更新-arch標誌以使用x86而不是x64。