dnx ef migrations add Initial dnx:System.ArgumentNullException:Value不能为null

时间:2016-01-24 13:05:41

标签: asp.net asp.net-core

有关于此的任何想法吗?

我的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> 

1 个答案:

答案 0 :(得分:-1)

将我的评论答案移到实际答案(并稍微清理一下) - 看起来版本错了。默认显示为clr,即使活动版本是coreclr。在这种情况下,我建议明确告诉dnvm / dnu / dnx将活动运行时与活动arch一起用于各种构建命令,例如:dnvm exec 1.0.0-rc1-update1 -r coreclr dnu build并且还可能更新-arch标志以使用x86而不是x64。