C# Visual Studio“重建全部失败”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11047079/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 16:15:32  来源:igfitidea点击:

Visual Studio "Rebuild all failed"

c#visual-studio-2010

提问by AndreaCi

Why does Rebuild fail with no errors?

为什么重建失败且没有错误?

Since this morning, this error keeps showing up. I build the entire solution (25 C# managed projects) and a "Rebuild All failed" appears, but without any errors! (I have 13 warnings about COM not supporting Generics, but it's "normal" because one dll is exposed as COM.)

从今天早上开始,这个错误一直出现。我构建了整个解决方案(25 个 C# 托管项目)并出现“重建全部失败”,但没有任何错误!(我有 13 条关于 COM 不支持泛型的警告,但这是“正常的”,因为一个 dll 公开为 COM。)

Screenshot of 0 Errors with "Rebuild All failed"

“重建全部失败”的 0 个错误的屏幕截图

回答by Tomtom

Have you tried to clean the solution befor rebiuld it?

您是否尝试在重新构建之前清洁解决方案?

回答by Oscar Foley

This is the list of checks & things I would do if I were you (try to build after each step):

这是检查清单和如果我是你我会做的事情(尝试在每个步骤之后构建):

  • Is error list activated? (Sometimes I forgot to activate and I can see only warnings & messages)
  • Check output window for error messages..
  • Clean solution.
  • Double check after clean that everything is deleted from debug folders.
  • Build it in release mode.
  • Build solution project to project until you isolate problematic project.
  • Remove COM and comment code to see if is this the source of problem.
  • Restart VS2010.
  • Restart windows.
  • 错误列表是否已激活?(有时我忘记激活,我只能看到警告和消息)
  • 检查输出窗口是否有错误消息..
  • 清洁溶液。
  • 清洁后仔细检查所有内容是否已从调试文件夹中删除。
  • 在发布模式下构建它。
  • 构建解决方案项目到项目,直到您隔离有问题的项目。
  • 删除 COM 和注释代码,看看这是否是问题的根源。
  • 重启VS2010。
  • 重新启动窗口。

回答by Andras Zoltan

Not an answer per se - but you're better off looking at the output window and seeing what it says there.

本身不是答案 - 但你最好查看输出窗口并查看它在那里说的内容。

Also, to help with that you might want to look at your MSBuild verbosity - as shown on this screenshot (last two options):

此外,为了帮助您解决这个问题,您可能需要查看您的 MSBuild 详细程度 - 如此屏幕截图所示(最后两个选项):

Build options - Visual Studio

构建选项 - Visual Studio

Beware - the highest level generates a MASSIVE amount of information.

当心 - 最高级别会产生大量信息。

Finally - running msbuildfrom the solution folder in a command prompt will really nail the issue - because error messages and warnings come up in red and yellow respectively.

最后 -msbuild在命令提示符下从解决方案文件夹运行将真正解决问题 - 因为错误消息和警告分别以红色和黄色出现。

回答by christiandev

  1. clean the solution
  2. Try and build each project and see where the issue is.
  3. Check each of the references (of each project) to make sure not have the yellow warning sign
  1. 清洁溶液
  2. 尝试构建每个项目,看看问题出在哪里。
  3. 检查每个参考文献(每个项目的)以确保没有黄色警告标志

Has the solution ever built?

解决方案是否曾经构建过?

回答by kovalex

Few moments ago I fix it with repair of .NET Framework installation (.NET Framework v4.0 Extended in my case).

不久前,我通过修复 .NET Framework 安装(在我的情况下为 .NET Framework v4.0 Extended)修复了它。

回答by Steve Giese

I just had this happen to me, and realized that I left a '#error' line in my code and forgot about it. When I tried to build, the build failed but the #error line didn't show up in my errors.

我刚刚发生了这种情况,并意识到我在代码中留下了“#error”行并忘记了它。当我尝试构建时,构建失败但 #error 行没有出现在我的错误中。

Try searching all for '#error'

尝试搜索所有“#error”

回答by Umut D.

I found my own solution and it is simple:

我找到了自己的解决方案,这很简单:

When this error occurs, save the project and close VS 2013. After that, re-open VS2013 and open the last project.

出现这个错误时,保存项目并关闭VS 2013。之后,重新打开VS2013并打开最后一个项目。

It works like a charm. But it is very annoying every time!

它就像一个魅力。但是每次都很烦!

Many people reported this problem in VS2010, VS2012 and VS2013.

许多人在VS2010、VS2012和VS2013中报告了这个问题。

回答by Keith Robertson

Could be a corrupt Solution User Options file.

可能是损坏的解决方案用户选项文件。

Close the solution, delete its .suo (.v12.suo for VS2012+), reopen the solution, and Visual Studio will build a new one. You will lose the StartUp Project, breakpoints, bookmarks, which files are open, which projects/folders are expanded, etc. But that's all minor compared to the solution not building!

关闭解决方案,删除其 .suo(VS2012+ 为 .v12.suo),重新打开解决方案,Visual Studio 将构建一个新的。您将丢失启动项目、断点、书签、哪些文件已打开、哪些项目/文件夹已展开等。但与未构建的解决方案相比,这些都微不足道!

回答by CindyH

I fixed it on my new implementation of Visual Studio 2013 by going to the database project / Project Settings and noticing that the Target Platform was SQL Server 2014 instead of 2012 like it should be.

我通过转到数据库项目/项目设置并注意到目标平台是 SQL Server 2014 而不是 2012 像它应该的那样在我的 Visual Studio 2013 的新实现上修复它。

回答by CodeMad

I got a similar issue today, and fixed it with repair.

我今天遇到了类似的问题,并通过修复修复了它。

  1. Start
  2. Run…
  3. Appwiz.cpl
  4. (Find your installed Visual Studio version)
  5. Right click
  6. Change
  7. Repair
  1. 开始
  2. 跑…
  3. Appwiz.cpl
  4. (找到您安装的 Visual Studio 版本)
  5. 右键点击
  6. 改变
  7. 修理

Screenshot of empty error list with "Rebuild All failed"

带有“全部重建失败”的空错误列表的屏幕截图