119

My project builds all fail but I'm not shown any errors. I tried cleaning and rebuilding, that didn't work.

I changed the MSBuild output verbosity to 'Diagnostic' hoping it would help me identify the problem and now I'm stuck. Here's what the output looks like:

1>Project 'ProjectMM.Data.Models' is not up to date. Input file 'C:\Projects\ProjectMM\ProjectMM.Data.Models\ProjectMM.Data.Models.csproj' is modified after output file 'C:\Projects\ProjectMM\ProjectMM.Data.Models\bin\Debug\ProjectMM.Data.Models.pdb'.
All packages are already installed and there is nothing to restore.
1>------ Build started: Project: ProjectMM.Data.Models, Configuration: Debug Any CPU ------
2>Project 'ProjectMM.Data' is not up to date. Input file 'C:\Projects\ProjectMM\ProjectMM.Data\ProjectMM.Data.csproj' is modified after output file 'C:\Projects\ProjectMM\ProjectMM.Data\bin\Debug\ProjectMM.Data.pdb'.
2>------ Build started: Project: ProjectMM.Data, Configuration: Debug Any CPU ------
3>Project 'ProjectMM' is not up to date. Input file 'c:\projects\projectmm\projectmm\app_start\bundleconfig.cs' is modified after output file 'C:\Projects\ProjectMM\ProjectMM\bin\ProjectMM.pdb'.
3>------ Build started: Project: ProjectMM, Configuration: Debug Any CPU ------
========== Build: 0 succeeded, 3 failed, 0 up-to-date, 0 skipped ==========
jpo38
  • 20,821
  • 10
  • 70
  • 151
Rob Greenlee
  • 1,217
  • 2
  • 8
  • 10
  • 1
    Does your Error List window is showing up or not? – Karthik Aug 10 '15 at 04:05
  • Go to View menu -> Select Error List and check if you have any errors. Ideally you should get it in Error List. Keep your Error List window in open and try building the project and see what happens.. – Karthik Aug 10 '15 at 04:08
  • 4
    So, here's what just happened: I posted this question and assuming I wouldn't get a response right away, I closed the project. You prompted me to open it back up, open the error list and rebuild. It worked perfectly, no errors, all succeeded! – Rob Greenlee Aug 10 '15 at 04:12
  • @RobGreenlee: See my answer, I bet the "Error tab" was active when you re-opened the solution! – jpo38 Apr 19 '17 at 14:16

30 Answers30

134

It's possible that you're not seeing all the build errors.

By changing the drop down list after the "Messages" icon from "Build + Intellisense" to "Build Only", you will be able to see errors thrown during the build that are not detected by Intellisense. See the screenshot below:

Build

JNYRanger
  • 6,829
  • 12
  • 53
  • 81
  • 23
    Why would the "Build Only" errors not be present in "Build + Intellisense"? – CodyF Dec 19 '16 at 19:54
  • This helped with showing the errors in the error list, but the lines of code with the errors have no red underlines. I'm guessing this must be an Intellisense issue then. – Drew Mar 30 '17 at 21:48
  • This was beyond frustrating. Apparently the issue is still open in a different ticket: https://github.com/dotnet/roslyn/issues/19693 – valverij Nov 06 '17 at 17:07
111

I have had the same problem and closing and re-opening Visual Studio clears it up.

I had also tried Cleaning the solution and the Clean Failed as well.

There may be other scenarios where this does not do the trick, but in my case restarting has resolved this for me.

Carson Evans
  • 1,518
  • 1
  • 13
  • 12
  • 22
    If it doesn't help to restart. I often encounter this problem when I add a project to my solution, with another Target framework referencing different framework projects. – Bastiaan Linders Nov 23 '15 at 10:44
  • 7
    In my case restarting VS or cleaning the solution didn't help. However, removing the .suo under the .vs folder solved the problem – cellik Dec 04 '15 at 12:32
  • @cellik : It doesn't work in my case. What is worth..I'm using Enterprise edition. – KMC Aug 16 '16 at 20:33
  • Restarting VS worked for me, but now it's cropping up with every build! Do I really want to wait for VS to start (slowww) every time I build? – Philip Schiff Sep 07 '16 at 14:34
  • This is crazy that we accept this as our solution. I have this same issue and it appears to be with a single new solution that was targeted against 4.6.1 framework. I have yet to have the other 30+ older solutions do this. – JustinMichaels Sep 12 '16 at 17:52
  • 4
    I had the same problem after changing my computer time from CEST time zone (GMT+1) to US time zone (GMT-7), it seems that it could not handle that the time stamp of the last build was in future. After restarting VS everything is OK. – martinh_kentico Nov 01 '16 at 22:27
  • After leaving my computer locked over the weekend, I was having this problem and restarting Visual Studio 2015 (enterprise - update 3). – Eric Milliot-Martinez Nov 07 '16 at 18:15
  • 2
    Deleting the .suo files did the trick for me as well, restarting and cleaning did not. – Johann Marx Nov 16 '16 at 15:38
  • @martinh_kentico, spot on. –  Jan 03 '17 at 18:41
  • @martinh_kentico, bingo! To the letter, this is what happened to me. I work in NJ, today on a trip to TN, opened Visual Studio, changed laptop time zone from Eastern to Central and blam. Closed/Reopened, and all is well. – TomK Feb 28 '17 at 03:02
  • This fix did the trick for me in VS 2019. I just wanted to point out that I mysteriously found *40* instances of MsBuild running in Task Manager at the time, all of which closed when all my open instances of VS were closed. I watch Task Manager routinely and saw nothing out of the ordinary shortly before the error occurred. This may be a clue to the underlying problem, whatever it is. – SQLServerSteve Oct 10 '20 at 02:35
  • I had a similar issue. I was running VS 2019 as administrator, When I finally tried running regularly, it worked. This was on a minimal VB HelloWorld app (1 form, 1 button, 1 label, that's all) – David Neuschulz Nov 18 '20 at 20:44
32

I've been seeing regular instances of VS2015 reporting "build failed" but not showing any errors in the error window. Coming from an ancient command line background, I finally went looking at the output window. The output window showed the compiler reporting errors but those errors were not being captured to the error window. I never saw this problem under VS2013.

The usual closing of VS and reopening of it hasn't cleared this condition. (In VS2013 this was a common way to kick XAML intellisense in the rear and make it stop fixating on an "error" that had been fixed.)

So far this has always been related to compilation errors in a XAML page CS file. I can't remember seeing it in a non-page CS file.

Until one figures out to go check the output window, things like intellisense reporting in the error window invalid references to objects in the XAML, but no compiler errors being shown in the error window can get VERY confusion since it "appears" like the errors are the intellisense reporting XAML errors. But they actually aren't. The XAML errors are just symptoms of CS files failing to compile but not having their errors reporting in the error window.

Keith
  • 349
  • 2
  • 2
  • 20
    For those of you still struggling with an invisible errors window, it appears you can get the compiler errors to show up in the window by selecting **Build Only** in the **Filter ErrorList To** dropdown in the Error List window (the dropdown is not labelled... You can figure out which one it is by hovering the mouse over it and observing the tooltip). – Robert Harvey Aug 27 '15 at 00:10
  • 2
    @RobertHarvey ... this is the key... but WHY in the world would Intellisense override the build? – felickz Dec 10 '15 at 16:42
  • @RobertHarvey that was exactly it. Turns out, as someone here suggested I was referencing an incompatible .net project, but I couldn't tell what the problem was until I switched the output to "Build Only" in the Error pane. As soon as I did that it pointed me right to the issue. Thank you for the tip. – David Gunderson Jan 21 '16 at 08:06
  • This answer was the clue for me. Search for "error CS" (no quotes) for possible blocking build exceptions. – granadaCoder Jul 18 '16 at 19:03
  • PS. My error was that I had used the same variable name in my method. "string x = string.Empty;" for example. I had an exception handler that also had a "string x" declaration in it. – granadaCoder Jul 18 '16 at 19:07
  • @Keith: Did you ever solved the problem? I have exactly the same (build failed, error is NOT showed in error-list but in output-window). I work with VS2015 update 3 RC and strange wise have the problem only with my Xamarin.Forms project, where I don't have it in another VB.net project opened with the same VS2015). – FredyWenger Aug 03 '16 at 17:01
12

Deleting the hidden .vs folder for worked for me for VS2015.

(Note that this is where the SUO files live now)

Mike Asdf
  • 2,309
  • 26
  • 34
10

This might happen when you reference a different .net framework version project (v4.5.2 vs v4.5 in my case). Correcting this will fix your problem.

Claudiu Constantin
  • 2,138
  • 27
  • 38
  • This was exactly my problem. Added a new project to the solution which was v4.5.2 and I referenced it from another project which was v4.5. Switched the new project to v4.5 and it worked fine. – Drew Mar 30 '17 at 22:07
7

Check all your project Framework versions, and make sure they're all the same, or at least that project A doesn't reference project B when project B's .NET Framework version is higher.

Daniel Minnaar
  • 5,865
  • 5
  • 31
  • 52
7

What happened by me was, changing the timezone on the computer to +5:30 and then changing it back -5:00 is what confused VS. When I restarted VS, it worked fine again.

M B
  • 2,326
  • 24
  • 33
  • no clue. I do use version control so it could be that got confused with the times??? – M B Feb 16 '17 at 15:32
7

I don't know whether I am the only one who is facing this problem.

In my case when I opened Visual Studio the timezone was in GMT+1:00, and the build was successful. Then I changed the timezone to GMT+5:30, and then without restarting the Visual Studio, I tried to run the application, but the build failed without any error or warning.

I changed back the timezone to GMT+1:00, and the build succeeded without any mistake.

Rudresha Parameshappa
  • 3,826
  • 3
  • 25
  • 39
6

I had this problem with VS2015 Update 3 RC and Xamarin (.Forms shared project).
Compiler don't stop, errors were only showed in the output window.
This only for Xamarin projects (with VB.NET projects all has worked as expected)...
To try find the reason for the problem, I have changed the Build Output in VS:
- menu "Tools - Options"
- from the left panel: "Projects And Solutions: Build And Run":
- change "MSBuild Output Verbosity" from "Minimal" to "Diagnostic"

After doing that, the compiler has stopped and the error was showed..
After that, I have set the option back from "Diagnostic" to "Minimal" (like it was before) and... it has worked also with "Minimal" (to be sure, I also have restarted VS)...

So.. it seems (at least im my case) that only to change (touch) the setting (MSBuild Output Verbosity") has solved the problem and that this is a bug in VS and/or the Xamarin integration Software...

FredyWenger
  • 2,236
  • 2
  • 32
  • 36
  • 1
    Why isn't this answer more highly upvoted? It gives you the perfect solution to debug what is wrong – John Demetriou Jan 13 '17 at 07:25
  • Check my answer below. I aslo thought your solution was right but I realized that even with the "Diagnostic" output level, my "Error tab" would remain empty. As other ones, you most likely kept the "Error tab" active and that's why it started working fine... – jpo38 Apr 19 '17 at 14:42
2

What I did (after all the above, and it still wasn't working) was go through all the bin folders and clear them all out (ie the referenced projects too).

This worked for me, hope it does for you too.

Rodney Ellis
  • 727
  • 2
  • 13
  • 28
2

I had this problem and it turned out that I had a using pointing to an empty namespace. Removing that using clause fixed the problem

Phate01
  • 2,499
  • 2
  • 30
  • 55
2

Check the warnings..

I had the new class library with target .Net Framework 4.5 while the referencing project was 4.0 which caused reference issue.

After modifying the class library with target .Net Framework 4.0 it worked correctly.

gyansada
  • 41
  • 2
2

Nothing from the answers above helped to me. After many experiments I have finally found that the problem is a reference of Microsoft.Net.Compilers v2.10.0 in one of the projects. VS 2015 uses MSBuild v14 which does not support that version of Microsoft.Net.Compilers.

1

For me this issue was related to a custom CodeAnalysis ruleset setting "IncludeAll".

It appears the Compiler observes this setting:

  <IncludeAll Action="Error" />

But IntelliSense took the default ACTION on the Rule Id which was "Warning". This would explain the behavior seen by @RobertHarvey where you filter the output by Build Only and it shows as an ERROR, but if you filter by Intellisene Only it shows as WARNING. Filtering output by the default Build + Intellisense seems non-deterministic!

My fix was to explicitly call out the rule that i wanted to be a warning as a warning.

  <Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp" RuleNamespace="Microsoft.CodeAnalysis.CSharp">
    <Rule Id="CS0618" Action="Warning" />
  </Rules>

This is potentially a problem with Intellisense not observing the IncludeAll option. See https://github.com/dotnet/roslyn/issues/7400

felickz
  • 4,292
  • 3
  • 33
  • 37
1

This can also happen when migrating a project to Visual Studio 2015 with an older Framework. Check your Warnings in your Error List. You may see something like project is currently .NET version 2.0 and requires .NET 3.5 or higher. If you find a similar warning go to your project's properties and target the required .NET Framework.

Tyriddik
  • 104
  • 1
  • 6
1

Please check warnings. Sometimes build failed because of some kind of warnings too.

Krish
  • 616
  • 9
  • 19
1

When open a solution, generate it, I can see some build errors or warnings reported in the "Output tab", while the "Error tab" does not report any problem.

enter image description here

You can see that the "Error tab" config is OK ("Build only" and "Entire solution" selected).

Note that, after a deep investigation, I identified that this only occurs only if the "Error tab" was not shown yet when you start the build!

If you activated the "Error tab" before doing the build (or if it was the current tab when you launched Visual), then newly found errors/warnings will show up correctly:

enter image description here

It's as if the "Error tab" is initialized only when it gets visible (which may be true as it takes more time to show up first time you click it...), and, if it was not, it does not gather build results...

So far, having no better answer to this problem than "activate the Error tab before building".

And I bet that's why "restarting VS" sometime works. You see the "Error tab" is empty, you close and repoen VS, then, "Error tab" is shown by default as VS restored the current active tab from previous session. You build and now the "Error tab" gets populated...! You just got lucky.

Note: Reported a VS bug: https://connect.microsoft.com/VisualStudio/feedback/details/3132689

jpo38
  • 20,821
  • 10
  • 70
  • 151
  • This solution worked for me. It happened to me once - no warnings were displayed. I opened the Error List window and rebuilt the solution. The warnings were displayed this time. I can't reproduce the same issue again even after restarting the VS. – I-A-N May 04 '17 at 10:30
1

For me the build failed without errors, but after some light investigation I found out that the refence to MSHTML wasn't found by VS.

enter image description here

The behavior appeared after an update to Windows 10. To fix it you need to register the assembly from the GAC. For how to do it, go to this answer MSHTML DLL on Windows 10 that's where I found my answer.

Fid
  • 568
  • 5
  • 13
1

MSBuild.exe is changed in the directory (C:\Program Files (x86)\MSBuild\14.0\Bin)

so i just replace the MSBuild.exe from other pc which has vs2015.

Now it working fine.

sabarish
  • 11
  • 1
0

Taken from this answer

Compilation failed, no errors were showed in the output window.

To try find the reason for the problem, I have changed the Build Output in VS: - menu "Tools - Options" - from the left panel: "Projects And Solutions: Build And Run": - change "MSBuild Output Verbosity" from "Minimal" to "Diagnostic"

After doing that, I found the real reason which was in fact a mistake with dependency projects. I project that I was depending on was built for different framework (newer) than mine. Thus creating the issue. The errors was only outputed when I put the Output Verbosity to Diagnostic

Community
  • 1
  • 1
John Demetriou
  • 4,093
  • 6
  • 52
  • 88
  • It's not just about figuring the problem, it's about learning how to troubleshoot the problem. This is why I included other answers debugging process, because that is what helped me find out what is wrong. Not just random guesses on what the problem might be – John Demetriou Jan 13 '17 at 07:33
0

For me, it was a rogue attached property. The problem wasn't necessarily that I couldn't see an error; the error was the following:

Child node "2" exited prematurely. Shutting down. Diagnostic information may be found in files in the temporary files directory named MSBuild_*.failure.txt.

Initially, the build would hang and not show any errors unless you attempted to close Visual Studio. After restarting, it would hang for a long period upon building, then display the above message.

Deleting hidden .vs folder, rebuilding/cleaning solution, and restarting Visual Studio did not work. Removing the attached property did; ergo, it could be actual code somewhere that isn't working properly.

As a last resort, I would remove any recent changes one by one until the issue is resolved as none of the solutions here helped.

Update

Because I'm used to developing traditional WPF applications, I didn't realize you can't have "chained" XAML namespaces using .s with UWP. I was attempting to set an attached property using

My.Namespace:SomeClass.SomeProperty="SomeValue"

Whereas, it should just be

MyNamespace:SomeClass.SomeProperty="SomeValue"

It's not as pretty as I like, but it's the only way to go, apparently.

0

What worked for me:

Closing all documents solved the issue for me. (Same solution if intelliSense stops working)

(right click tab - Close All Documents)

Ziv Weissman
  • 4,400
  • 3
  • 28
  • 61
0

Try this

Excluding "mstscax.dll" from the Dependencies worked for me.

Abi
  • 724
  • 6
  • 22
Emile Cloete
  • 143
  • 1
  • 2
  • 10
0

Niche issue: I ran into the same issue just now. None of the answers above seemed to help.

Issue was for a Console program, one cannot mark the Main() method as async** which is what I was doing. Not sure, why Visual Studio could not specify why exactly the project was not building (I got 0 errors and 0 warnings every time). I am using Visual Studio 2015 Enterprise.

Fix: The work around for that is here.

user3613932
  • 1,219
  • 15
  • 16
0

After updating a dll file, it turned out that the new file was targeting a higher verion of .NET Framework. The solution was to go to Project Properties and change the Target framework to the appropriate version.

usefulBee
  • 9,250
  • 10
  • 51
  • 89
0

I found solution by changing .NET Framework from 4.5.2 to 4.0.

Problem was caused by reference that was not compatible with currently selected framework.

Stefan Đorđević
  • 565
  • 1
  • 4
  • 22
0

I just cleared my filters and it worked for me.The clear all filters icon is near the messages box .

0

Start a new project. Copy all of your code up to below namespace ConsoleApp38450983450.

Paste into new project below namespace ScrewedUpConsoleApp102343

Build and run perfect

0

In my case this was caused by a path to a filename which was too long for Windows. I found it by reverting to a previous version in git.

Sego
  • 310
  • 2
  • 5
-1

You should set the combobox at right side under error list, on 'Entire Solution' to see all errors.enter image description here

  • 1
    This rather old question already has an accepted answer, it doesn't seem as if your very short and undescriptive answer here adds much to it. Also, please do _not_ link to images on external sites but add the images to your answer! – Dux Jun 07 '18 at 21:20