Rob Greenlee
Rob Greenlee

Reputation: 1217

Visual Studio 2015 project builds failed but no errors

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 ==========

Upvotes: 119

Views: 76397

Answers (30)

Sego
Sego

Reputation: 320

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.

Upvotes: 0

Brandon Norris
Brandon Norris

Reputation: 1

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

Upvotes: 0

Nevin jose
Nevin jose

Reputation: 1

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

Upvotes: 0

Stefan Đorđević
Stefan Đorđević

Reputation: 595

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.

Upvotes: 0

Rudresha Parameshappa
Rudresha Parameshappa

Reputation: 3926

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.

Upvotes: 7

sabarish
sabarish

Reputation: 11

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.

Upvotes: 1

Petar Petrov
Petar Petrov

Reputation: 21

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.

Upvotes: 2

Milad Koudarzi
Milad Koudarzi

Reputation: 11

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

Upvotes: -1

gyansada
gyansada

Reputation: 41

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.

Upvotes: 2

usefulBee
usefulBee

Reputation: 9702

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.

Upvotes: 0

Fid
Fid

Reputation: 568

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.

Upvotes: 1

user3613932
user3613932

Reputation: 1397

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.

Upvotes: 0

Emile Cloete
Emile Cloete

Reputation: 163

Try this

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

Upvotes: 0

Ziv Weissman
Ziv Weissman

Reputation: 4536

What worked for me:

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

(right click tab - Close All Documents)

Upvotes: 0

jpo38
jpo38

Reputation: 21544

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

Upvotes: 1

user1618054
user1618054

Reputation:

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.

Upvotes: 0

M B
M B

Reputation: 2326

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.

Upvotes: 7

John Demetriou
John Demetriou

Reputation: 4391

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

Upvotes: 0

FredyWenger
FredyWenger

Reputation: 2325

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

Upvotes: 6

Krish
Krish

Reputation: 656

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

Upvotes: 1

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

Upvotes: 134

Mike Asdf
Mike Asdf

Reputation: 2329

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

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

Upvotes: 12

Phate01
Phate01

Reputation: 1795

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

Upvotes: 2

Tyriddik
Tyriddik

Reputation: 104

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.

Upvotes: 1

Claudiu Constantin
Claudiu Constantin

Reputation: 2228

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.

Upvotes: 10

Rodney Ellis
Rodney Ellis

Reputation: 807

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.

Upvotes: 2

felickz
felickz

Reputation: 4461

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

Upvotes: 1

Daniel Minnaar
Daniel Minnaar

Reputation: 6315

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.

Upvotes: 7

Carson Evans
Carson Evans

Reputation: 1568

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.

Upvotes: 111

Keith
Keith

Reputation: 349

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.

Upvotes: 32

Related Questions