How to find reason of failed Build without any error or warning

C#asp.net.NetVisual Studio-2010

C# Problem Overview


I have a WebApplication which contains reference to WCF services.

While building using Visual Studio 2010, Build fails without any error or warning. However building the .csproj using MsBuild is successful.

Can't figure out what should I try in Visual Studio, to resolve / diagnose the issue. Can you please help out?

EDIT:

I find out that the build has been failing,

  1. From text displayed in status Bar.
    enter image description here

  2. From output window :

     ========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
    

C# Solutions


Solution 1 - C#

Build + Intellisense swallowed the error messages. Selecting Build Only displayed them.

Screenshot

Solution 2 - C#

I just ran into a similar situation. In my case, a custom action (from the MSBuildVersioning package available on Nuget.org - http://www.nuget.org/packages/MSBuildVersioning/) which appeared in the csproj file's BeforeBuild target was failing without triggering any error message in the normal place.

I was able to determine this by setting the "MSBuild project build output verbosity" (in the latest Visual Studio's Tools tab [Path: Tools > Options > Build and Run]) to "Diagnostic" as shown below. This then showed that the custom action (in my case HgVersionFile) was what had failed.

Screen capture from Visual Studio showing the modified setting.

Solution 3 - C#

  • If solution contains more than one project, try building them one at a time.
  • Try restart Visual Studio.
  • Try restart Computer.
  • Try "Rebuild all"
  • Try "Clean Solution" then remove your "vspscc" files and "vssscc" files and then restart Visual Studio and then "Rebuild All".

Solution 4 - C#

VS (2013 Pro, Win 8.1) restart did it for me.

Solution 5 - C#

Delete .vs folder & restart VS, worked for me

enter image description here

Solution 6 - C#

I want to expand on Sasse's answer.

To fix the problem with Visual Studio 2015 Update 2 I had to build each project one at a time and look at the output window after each build.

One project gave me >"The type or namespace name 'SomeNamespace' does not exist in the namespace 'BeforeSomeNamespace' (are you missing an assembly reference?)".

There was no error in the Error List window but the assembly had a yellow warning sign under "References".

I then saw that the referencing project targeted 4.5.1 and the referenced project 4.6.1. Changing 4.6.1 to 4.5.1 allowed the overall build to succeed.

Solution 7 - C#

Seems that there are multiple answers to this question, so I'll add mine from personal experience hoping it will save someone time/stress.

Make sure all the projects in your solution are targeting the same .NET version.

Similar to OP, there were 0 errors but the build kept failing. However, there was one warning entry (buried in between several hundred useless XML warnings...) saying that one project was targeting a different .NET version than a project that was referencing it. The entire issue was that one project within my solution was targeting .NET 4.5.2, when the rest were targeting 4.5.1. It should work even with this discrepancy (hence why it was just a warning) but unfortunately, it broke the build.

The strange part was that it built/ran fine for a while, but suddenly the build started failing one time causing this issue. Not sure what I did for it to start complaining about differing .NET target versions, but I feel that there are just some mysteries in Visual Studio that will never be solved.

Solution 8 - C#

Nothing was working for me so I deleted the .suo file, restarted VS, cleaned the projected, and then the build would work.

Solution 9 - C#

I have faced the same issue recently, I also tried so many things like, restart Visual Studio, Clean and rebuild Solution, restart PC etc. (First of all make sure all the projects in your solution are targeting the same .NET version.)

But apparently nothing worked for me so I followed the below procedure;

  1. Save pending changes in the project and close Visual Studio
  2. Find the exact location from file explorer and find "obj" file and open it,

enter image description here

  1. Then, delete all the included files (some files won't remove, it doesn't matter, just skip them).

  2. Use run command (by pressing Windows Key + R) and type "%temp%" and press enter to find temporary files.

  3. Finally, delete them all.

This worked for me, hopefully it works for your case.

Solution 10 - C#

I had this same problem and I traced this issue down to the Error List options "Build + Intellisense".

If this option is selected then no errors are shown in the list. Switch to "Build Only" and the errors appear as expected.

Its look like a bug in Visual Studio. Restarting the visual studio solved this issue.

Solution 11 - C#

Firstly "Clean the Solution" , then Rebuild soln.

If won't work close the Solution and restart the solution.

Try these things, hope definitely works.

Solution 12 - C#

On other possibility is that Visual Studio needs to run as Administrator, this might be related to deploying to local IIS server or other deployment need.

Solution 13 - C#

this can happen when one of the projects referenced is a higher version of the .NET framework than your current project.

Solution 14 - C#

Just for the sake of completion and maybe helping someone encountering the same error again in the future, I was using Mahapps metro interface and changed the XAML of one window, but forgot to change the partial class in the code-behind. In that case, the build failed without an error or warning, and I was able to find it out by increasing the verbosity of the output from the settings:

Error pane

output pane

Solution 15 - C#

Go to output window , search for 'error' in output window, TADA

Solution 16 - C#

Try building your project from the Powershell command line:

dotnet build

Then you can see any errors in the command line output even if Visual Studio is playing hide and seek with build error messages.

Solution 17 - C#

For me, the Target Framework was the issue.

My project's Target Framework was 4.5.2 and the referenced project's Target Framework was 4.6.1.

Once I updated my project's Target Framework to 4.6.1, the issue got fixed.

Solution 18 - C#

I had a similar problem after adding a new project (called "TestCleaner") to my solution: Build failed, no errors.

I increased output verbosity (see Richard J Foster's instructions) and searched the output for "failed". I quickly discovered which project was failing, and why: project "TestRunner" had failed with "error CS0246: The type or namespace name 'TestCleaner' could not be found" (even though no problems were highlighted in the code).

Checking TestRunner's references, sure enough the reference to TestCleaner was marked as unresolved, and the path was missing from the reference properties. Deleting and re-adding didn't fix it. Again, no explanation why.

unresolved reference

I finally discovered the cause: "TestCleaner" was using a different target framework to the other projects. It was .Net 4.5.2; the others were 4.5.

Solution 19 - C#

I had the same problem. The error list window has 2 dropdowns "Show items contained by" and "Show issues generated". These names are visible after hovering over the dropdown. The "Show issues generated" dropdown was set to "Build + IntelliSense" and after changing to "Build Only" the errors appeared on the list.

Solution 20 - C#

In my case I set Diagnostic for the MSBuild verbosity as shown here.

Guess what... in the last line of the Output window in Visual Studio it showed this:

2>"C:\Company\Project\project.sharded\Project\Project.csproj" (Rebuild;BuiltProjectOutputGroup;BuiltProjectOutputGroupDependencies;DebugSymbolsProjectOutputGroup;DebugSymbolsProjectOutputGroupDependencies;DocumentationProjectOutputGroup;DocumentationProjectOutputGroupDependencies;SatelliteDllsProjectOutputGroup;SatelliteDllsProjectOutputGroupDependencies;SGenFilesOutputGroup;SGenFilesOutputGroupDependencies target) (1) ->
2>(CoreCompile target) -> 
2>  C:\Company\Project\project.sharded\Project\Services\UserService.cs(387,59,387,62): error CS0136: A local or parameter named 'sut' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter
2>
2>    2147 Warning(s)
2>    1 Error(s)

This looks like a bug in Visual Studio 2019 (16.3.5).

No errors were shown in the Error List window in Visual Studio.

This is the kind of errors that generally appear in the Error List window.

This is the offending line:

var sut = _sdb.SysUsableThreads.SingleOrDefault(sut => sut.uid == thread.uid && sut.thread_core == thread.core);

OK. Can't use sut because the var is named sut and I named the lambda sut. Again, this is the kind of thing that should be displayed in the Error List. For sure this is a bug in Visual Studio 2019. I reported it inside Visual Studio.

Solution 21 - C#

With Visual Studio 2019, I had to 'Run as as administrator' and it finally built ok. So open the application as admin (right mouse click- run as Administrator).

Solution 22 - C#

I faced the same problem! Just delete bin folder and restart your VS. That's all. tested in VS 2013.

Solution 23 - C#

What solved it for me was deleting the .vs folder from the root of the solution and restarting Visual Studio.

Also maybe important to say that even though the errors were not showing in the Error List pane, they were still present in the Output from the Build.

Solution 24 - C#

On my side, i got this problem when i added a new project (Library)

How i solved it

Right click the new added Library go to Properties then Application, under Application change the Target Framework to the framework of all projects.

The problem is that you have project using different target frameworks.

Solution 25 - C#

This happened to me after adding a new page to an asp.net project.

What I did was exclude the page, get it to build again successfully.

Then I added back the page with all the code commented out. Success.

Then I uncommented the code bit by bit and then it all worked.

Solution 26 - C#

I had the same problem after deleting a couple of forms. The errors popped up once I went into the code and did a "Show Definition" for one of the controls that I removed.

I was also targeting a higher framework on one of my projects, so that might have been the issue as well.

Solution 27 - C#

I've tried all but nothing worked in my case then I've changed these mentioned settings which resolved the issue quite well for me. Try If it could of any help latter viewers. These settings could be vary in your situation but make sure build all the including DLLs with the same config settings you kept initially (mentioned in the image.). Configuration Settings

Image here.

Cheers!

Solution 28 - C#

If nuget package 'Microsoft.Net.Compilers' is installed, make sure that it suits version of your Visual Studio (Build Tools version).

Versions 1.x mean C# 6.0 (Visual Studio 2015 and updates). For instance, 1.3.2

So don't upgrade to version above 1.x if you use VS2015

https://stackoverflow.com/a/44397905/3862615

Solution 29 - C#

I had really old project on older machine. Project was building correctly when I turned off machine. Today, I am getting build error but no error message. After trying some of suggestion from above, no luck.

In Visual Studio 2015, I turned on Detailed MSBuild under TOOLS > Options > Projects and Solutions > Build and Run

It gave me few details about build but no errors. After that I tried to check Extensions and updates (Tools > Extension and Updates) and found few of them needed update.

Nuget Package was culprit, after updating Nuget - build is successful.

enter image description here

Solution 30 - C#

It's may be due difference reportviewer version in your project and VS

Solution 31 - C#

Since everything did not work, found that errors don't show when opening the project as solution (.sln), while the error shows when opening the project as a project.

Solution 32 - C#

Restarting the Visual Studio worked for me. Also try restarting Visual Studio normally (Not Run as Administrator). Try Restarting the System and repeat above step.

Solution 33 - C#

A different way to reproduce this symptom:

I added a new project to an existing solution and the build output reported errors like "the type or namespace name X could not be found..." but no errors were presented in the error list.

The classes I referred to were in other projects (that were referenced) in the same solution.

It turned out that I by mistake had selected an earlier version of .net in the new project. Once I changed to the same version as the other projects, everything built without any errors.

Solution 34 - C#

I'm posting this answer because even though it's quite obscure, it is unique to the other answers and someone might come across it!

Double check for _underscore.aspx pages

I had a page and code-behind:

`myPage.aspx` and `myPage.aspx.vb`

when building the project, I'd get errors on the .aspx.vb page stating that properties defined on the .aspx page didn't exist, even though the page itself would build fine and there were NO OTHER ERRORS showing in the output (even with diagnostic level build output).

I then came across a page in the project that was named the same thing but with an underscore: _myPage.aspx - not sure where it came from, I deleted it, and the solution built fine.

Solution 35 - C#

I faced this problem once. and indeed there was a build error but it is not showing the error. I solved this problem by going through the output window and find out the error.

Solution 36 - C#

Go to C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE

Right click on devenv.exe and select Troubleshoot Compactibility -> TroubleShoot Program

Then check the checkbox "The program required additional permissions" and click next.

Restart the machine.

Done.

Solution 37 - C#

Just to let you guys know, if anyone will find same issue.

I had same problem, tried each solution.

  • Deleting temp files.
  • Deleting .suo <- This caused mi XAML to light up with errors like a christmas tree.
  • Reinstalling and Repairing VS.
  • Rebuilds and searching for errors with diagnostics.

The issue was that VS was not run as Admin... So, just so you know :D

Solution 38 - C#

In my case, I copy the build output, paste it to a text editor, and ctrl+f some key phrases like ": error".

Sometimes the error list will not show these errors.

Solution 39 - C#

I had the same issue, I changed Tools -> Options -> Projects and Solutions/Build and Run -> MSBuild project build log file verbosity[Diagnostic]. This option shows error in log, due to some reasons my VS not showing Error in Errors tab!

enter image description here

Do above settings and in output copy in notepad/texteditor and search for error. It will show you all errors.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAbhijeetView Question on Stackoverflow
Solution 1 - C#Abu AbdullahView Answer on Stackoverflow
Solution 2 - C#Richard J FosterView Answer on Stackoverflow
Solution 3 - C#SasseView Answer on Stackoverflow
Solution 4 - C#Ignas VyšniaView Answer on Stackoverflow
Solution 5 - C#Arun Prasad E SView Answer on Stackoverflow
Solution 6 - C#user764754View Answer on Stackoverflow
Solution 7 - C#Alan ThomasView Answer on Stackoverflow
Solution 8 - C#AndyView Answer on Stackoverflow
Solution 9 - C#MrMalithView Answer on Stackoverflow
Solution 10 - C#Christlin PanneerView Answer on Stackoverflow
Solution 11 - C#Santosh KView Answer on Stackoverflow
Solution 12 - C#Bill YangView Answer on Stackoverflow
Solution 13 - C#mcmillabView Answer on Stackoverflow
Solution 14 - C#mcyView Answer on Stackoverflow
Solution 15 - C#Mahdi KhaliliView Answer on Stackoverflow
Solution 16 - C#user3810867View Answer on Stackoverflow
Solution 17 - C#Ankush JainView Answer on Stackoverflow
Solution 18 - C#Ben WhitmoreView Answer on Stackoverflow
Solution 19 - C#jakubiszonView Answer on Stackoverflow
Solution 20 - C#Leniel MaccaferriView Answer on Stackoverflow
Solution 21 - C#JaganYView Answer on Stackoverflow
Solution 22 - C#Nur UddinView Answer on Stackoverflow
Solution 23 - C#Ronald ReyView Answer on Stackoverflow
Solution 24 - C#ShonieView Answer on Stackoverflow
Solution 25 - C#toddmoView Answer on Stackoverflow
Solution 26 - C#Dennis KuypersView Answer on Stackoverflow
Solution 27 - C#Iqra.View Answer on Stackoverflow
Solution 28 - C#Roman MView Answer on Stackoverflow
Solution 29 - C#spicetView Answer on Stackoverflow
Solution 30 - C#Roohi AliView Answer on Stackoverflow
Solution 31 - C#MostaView Answer on Stackoverflow
Solution 32 - C#Junaid PathanView Answer on Stackoverflow
Solution 33 - C#DevosaurView Answer on Stackoverflow
Solution 34 - C#jamheadartView Answer on Stackoverflow
Solution 35 - C#Abdulhakim ZeinuView Answer on Stackoverflow
Solution 36 - C#ReishabhView Answer on Stackoverflow
Solution 37 - C#Krzysiek MastalerzView Answer on Stackoverflow
Solution 38 - C#Ray LionfangView Answer on Stackoverflow
Solution 39 - C#Jenish ZinzuvadiyaView Answer on Stackoverflow