Null reference on Entity Framework Migration(实体框架迁移的空引用)
问题描述
当我使用实体框架迁移的 Add-Migration 命令时,出现以下异常:
When I user the Add-Migration command of Entity Framework migration I get the following exception:
System.NullReferenceException:对象引用未设置为对象的实例.在 System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetFileName(项目项目,字符串 projectItemName)在 System.Data.Entity.Migrations.MigrationsCommands..ctor(对象项目,对象 startUpProject,字符串 configurationTypeName,字符串 connectionStringName,字符串 connectionString,字符串 connectionProviderName,PSCmdlet cmdlet)
有什么见解吗?
推荐答案
我以前见过这个解决方案中有多个项目,并且选择了错误"的项目作为启动项目.例如,其他人报告说,在 Azure 托管的 MVC3 网站中,他们将 Azure 项目作为启动项目,而不是 MVC 项目.在启动时切换到 MVC 项目解决了问题.
I've seen this before when there are multiple projects in the solution and the "wrong" project is selected as the startup project. For example, somebody else reported that in an Azure hosted MVC3 website they had the Azure project as the startup project instead of the MVC project. Switching over to the MVC project as the startup fixed the issue.
更新:此问题已在 EF5-beta2 中得到修复,现在可以在 NuGet 上使用.
Update: This has been fixed in EF5-beta2, which is now available on NuGet.
这篇关于实体框架迁移的空引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:实体框架迁移的空引用


基础教程推荐
- c# Math.Sqrt 实现 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- SSE 浮点算术是否可重现? 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- 如何激活MC67中的红灯 2022-01-01