添加迁移构建失败

添加迁移构建失败

本文介绍了EF Core 添加迁移构建失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个开发人员收到构建失败"的消息.在 .NET Core EF 项目中运行 add-migration 时,没有解释构建失败的原因.您如何解决此错误?

I have a developer that is getting "Build failed." when running add-migration in a .NET Core EF project, with no explanation of why the build failed. How do you troubleshoot this error?

这是他在包管理器控制台中得到的:

This is what he gets in the Package Manager Console:

附加信息:

我们还有一些其他开发人员使用相同的解决方案代码(包括我自己),他们在添加迁移方面没有问题.

We have a few other developers using the same solution code (myself included) that have not issues with add-migration.

这是我在包管理器控制台中看到的:

This is what I see in Package Manager Console:

我们已验证项目已构建,并且整个解决方案已构建.除了重新启动 VS2015 之外,我们已经多次完成dotnet restore"并重建所有内容.我们已经验证在解决方案资源管理器和包管理器控制台下拉列表中都选择了正确的默认解决方案.我们已经验证他在他的机器上安装了正确的 SDK.我不知道接下来要检查什么......任何时候我在添加迁移过程中遇到失败时,我都会获得足够的信息来指出要检查的方向,但只是构建失败."是一个相当无用的错误输出.

We've verified that the project builds, and the entire solution builds. We've done "dotnet restore" and rebuild all multiple times, in addition to restarting VS2015. We've verified that the correct default solution is selected both in Solution Explorer, and in the Package Manager Console drop-down. We've verified that he has the correct SDK installed on his machine. I'm at a loss as to what to check next...any time I've had a failure during add-migration I've gotten enough information to point me in the direction of what to check, but just "Build failed." is a fairly useless error output.

推荐答案

我遇到了完全相同的问题(.NET Core 2.0.1).

I had the exact same problem (.NET Core 2.0.1).

有时重建项目会有所帮助.

Sometimes it helps if the project is rebuilt.

我在2个Visual Studio中打开项目时也遇到了这个问题.
关闭一个 Visual Studio 修复了错误.

I also encounter the problem when I opened the project in 2 Visual Studios.
Closing one Visual Studio fixed the error.

这篇关于EF Core 添加迁移构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 16:57