gpt4 book ai didi

entity-framework - Entity Framework : Value cannot be null. 参数名称:类型

转载 作者:行者123 更新时间:2023-12-04 23:39:42 25 4
gpt4 key购买 nike

当我执行update-database命令时,它显示此错误消息

System.ArgumentNullException: Value cannot be null.
Parameter name: type

at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetProjectTypes(Project project, Int32 shellVersion)
at System.Data.Entity.Migrations.Extensions.ProjectExtensions.IsWebSiteProject(Project project)
at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetTargetDir(Project project)
at System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName, Boolean useContextWorkingDirectory)
at System.Data.Entity.Migrations.AddMigrationCommand.Execute(String name, Boolean force, Boolean ignoreChanges)
at System.Data.Entity.Migrations.AddMigrationCommand.<>c__DisplayClass2.<.ctor>b__0()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)

Value cannot be null.
Parameter name: type"?

最佳答案

解决方案:对我来说,解决方案就像重新启动Visual Studio一样容易。

Senario:我有这样的解决方案:

solution explorer

我将启动项目从Host更改为包含web.config的UI.Web项目,然后运行update-database命令,但它给了Value cannot be null.异常,直到我重新启动Visual Studio并重新运行update-database命令。这次它表现正常。

关于entity-framework - Entity Framework : Value cannot be null. 参数名称:类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41777590/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com