29

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.)

Screenshot of 0 Errors with "Rebuild All failed"

Community
  • 1
  • 1
AndreaCi
  • 809
  • 1
  • 9
  • 22
  • 11
    What is displayed in the 'Output' tab? – Mr47 Jun 15 '12 at 08:25
  • +1 for Mr47 i hate the Error List ... i can't remember how often it showed something that wasn't there and vice versa. It might take 2secs longer to search through the output but i always prefere it over the error list. Just wishing for highlighting warnings and errors (VS08). – dowhilefor Jun 15 '12 at 08:52
  • 4
    Just restarting Visual Studio and rebuilding helped me. Might be worth a try – Karsten Feb 23 '15 at 08:44
  • Make sure the Error List is set to display build errors. If it's set to display only Intellisense errors and warning, you won't see the cause of a build error. – Adrian McCarthy Dec 07 '21 at 22:58

25 Answers25

29

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):

Build options - Visual Studio

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

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

AakashM
  • 62,551
  • 17
  • 151
  • 186
Andras Zoltan
  • 41,961
  • 13
  • 104
  • 160
18

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.

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

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

Joshua T
  • 656
  • 8
  • 15
Umut D.
  • 1,746
  • 23
  • 24
  • 1
    For some reasons, one project (.csproj) contained only null characters. I restored the previous version from a backup and got 'Rebuild failed' problem. I closed everything, reopened and... tadam! "Close and reopen" seem to be a solution that happen (too) often with VS. – Maxime Jun 24 '14 at 19:43
  • 1
    Closing all instances of visual studio is best (didn't work for me when I only closed the solution I had a problem with) – David S. Feb 23 '15 at 10:37
  • 2
    What you just did is called "Close Open Principal", just kidding :P – Daniel B Jul 28 '15 at 05:34
  • 1
    Or we can say: "have you tried turning it off and on again" principal... :) – Umut D. Jul 28 '15 at 13:24
  • Apparently, this work on VS 2019 Community Ed. as well. Good job Microsoft...... – computercarguy Nov 24 '20 at 19:35
3

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!

Keith Robertson
  • 791
  • 7
  • 13
2

I had the same problem. I was trying to refrence a higher .net framework version(4.5.2) to lower .net framework version(4.5) which was causing build error. I made the version same in both projects and it worked.

Baqer Naqvi
  • 6,011
  • 3
  • 50
  • 68
2

Check the Output Window (View -> Output) as that will tell you what's going wrong. Sometimes a reference might be missing or there is an issue with the targeted version of .NET for one project in a solution.

Adam
  • 2,762
  • 1
  • 30
  • 32
1

Have you tried to clean the solution befor rebiuld it?

Tomtom
  • 9,087
  • 7
  • 52
  • 95
  • 10
    Rebuild is the same as Clean + Build : http://stackoverflow.com/questions/1247457/difference-between-rebuild-and-clean-build-in-visual-studio-2008 – Bridge Jun 15 '12 at 08:32
  • @Bridge: No, those are not exactly the same as explained in most of the answers to the question you linked to. Clean + Build cleans all of the projects and then builds all of the projects. Rebuild cleans and builds projects independently. Even if you have all the dependency information 100% correct, parallelism in the build can cause the steps to happen in an unpredictable order, which can affect the success of the build if different projects are sharing directories for build outputs or intermediate files. – Adrian McCarthy Dec 07 '21 at 22:56
  • *Usually the same – Bridge Dec 15 '21 at 10:29
1

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.
Oscar Foley
  • 6,817
  • 8
  • 57
  • 90
  • Yes - active I have no errors also in "output" I tried to clean the solution... Trying it now to delete all obj and debug and release folders (it will take 20 minutes :s ) (it's a release build) – AndreaCi Jun 15 '12 at 08:31
1

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

kovalex
  • 11
  • 1
1

I had the same issue in VS 2015. I tried the following with no success:

  1. Close VS project and reopen
  2. Close all open VS projects and reopen just the project that had the issue
  3. Clean solution
  4. Rebuild solution
  5. Delete all files in bin\debug and bin\release

Lastly I tried Keith Robertson's answer, delete .suo (\Visual Studio 2015\Projects\[ProjectName]\.vs\[ProjectName]\v14\.suo). Although this didn't get me a good build, it did finally give me an error message stating that I had two entry points to my application. I went to application properties (Alt + Enter) and select a Startup object from the drop down.

Michael
  • 8,362
  • 6
  • 61
  • 88
1

This error seems a bit generic to me. I also went through this situation, but I managed to solve it differently than any of the ones mentioned here.

I have a project and several dependencies. And one of these dependencies has undergone a change.

enter image description here

When compiling the main project in debug mode, I verified that everything was ok. However, switching to release mode and recompiling the problem occurred.Rebuild all failed and 0 Errors

enter image description here

By analyzing the debug output, I encountered an error:

enter image description here enter image description here

Although the build dependencies are configured correctly. When compiling in release mode, the main project did not find the new method created in the secondary project. So I had to recompile each secondary project one by one in release mode. After that, I recompiled the main project and everything worked.

Hope it helps someone!

Alexandre Neukirchen
  • 2,713
  • 7
  • 26
  • 36
1

Select the appropriate target framework
- Right click on project
- Properties
- In application tab, Select the target framework

1

I just had the same thing. For me, it helped to restart VS and run it as Administrator.

Mark
  • 1,258
  • 13
  • 25
0
  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

Has the solution ever built?

Christian Phillips
  • 18,399
  • 8
  • 53
  • 82
0

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.

Try searching all for '#error'

0

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.

CindyH
  • 2,986
  • 2
  • 24
  • 38
0

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

Screenshot of empty error list with "Rebuild All failed"

Michael
  • 8,362
  • 6
  • 61
  • 88
CodeMad
  • 950
  • 2
  • 12
  • 30
0

Once chance of getting this error is when we try re naming the service reference name, we give some other name in the service reference, but in the namespace some where it will be referring the old name, so if you delete and add a service reference then keep the same name, else we may face this error, but we can see the error in the Output window.

Madhav
  • 1
0

There are apparently many causes of this. I just found the cause of my issue: the .NET version of a new project I created was higher than the version of the top-level project. (4.5.2 vs 4.0)

James
  • 377
  • 4
  • 7
0

In my case it was the wrong date and time of computer.

Hamza Khanzada
  • 1,439
  • 1
  • 22
  • 39
0

I was getting no feedback/messages/errors. Just that all projects failed to build.

I closed and tried again--I noticed an error saying "you are not authorized to access..."

I clicked on my account, re-entered my credentials, and rebuilt the solution.

Voila! I got what I am used to seeing when I build a solution -- plenty of errors in all their glory.

Hope this helps someone.

historyguy64
  • 171
  • 1
  • 5
0

Here's yet another reason which may sound familiar to some. I had integrated some code into my solution that wrapped a DLL. The C# code file that came with it offered a nice managed API and handled the low-level LoadLibrary stuff to access the DLL. Both had the same base name, so I had SomeName.cs and SomeName.dll. I could just drop it into any project and it would work.

This wasn't so nice after a while as I started using it in different projects. I got copies of both the DLL and the wrapper code in multiple projects. So I figured it would be better to drop the wrapper code and the DLL into a new class library project and then reference that new project from other projects.

After I had done that, I started to get this issue. The build went well up until the very last stage and then failed without error. Output showed nothing but successes.

The problem was the name of the wrapping class library project. I used the same base name (SomeName) for this. By default the assembly name would be SomeName.dll and I already had one such file (the DLL to be wrapped), thus I had a conflict with output files.

After renaming the wrapping project and its output assembly to SomeNameWrapper, the problem went away.

This may not be your exact cause but it seems likely you have some name clash or deployment issue as well. And it is not surprising the compiler won't give you an error because there is no problem in the compilation phase, the trouble starts with deployment and apparently this does not come out in an obvious way.

Martin Maat
  • 714
  • 4
  • 23
0

I had the same problem the original poster was displaying with 0 errors and Rebuild all succeeded. The Output tab showed a message that a referenced dll was built with a higher version of the .NET Framework.

Changing the .NET framework to match resolved the issue I was having with 0 Errors and Rebuild All succeeded.

Russell D
  • 326
  • 2
  • 9
0

The solution: Because Prerequisites not set for debug set only for release 01-Change solution configuration ( in main screen ) set (debug to release) set solution platform to (Any CPU) 02-Set Prerequisites for debug ( If you want to continue in debug mode ) 03-set target platform version for all Projects

gasan
  • 1
0

Some of the files included in your solution are not in the correct directories, or you have changed the name of one or more directories in your application. In the solution explorer under Setup review the list of all files and remove those that are not properly listed in the SourcePath Property.

0

One of my dependency in View file caused this. Check your view files for any dependencies which is not injected yet.

Hakkı
  • 811
  • 2
  • 13
  • 23