Visual studio compiling failed without any errors [duplicate] - c++

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?
I find out that the build has been failing,
From text displayed in status Bar.
From output window:
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
The output tab includes configuration details.
------ Build started: Project: <projectName here> Configuration: Debug Any CPU

I noticed that if "Build + Intellisense" is selected in the Error List, it causes the error messages to be swallowed.
Change this option to "Build Only", and all error messages will be displayed:
I don't know if this is a bug in Visual Studio or what, but it certainly revealed hidden error messages that were the key to pinpointing the failure for me.
Some, like Richard J Foster, have suggested increasing the "MSBuild project build output verbosity" setting to "Diagnostic" (the highest possible option), but this didn't solve the problem for me, as Visual Studio appeared to be suppressing the error message(s) themselves.
As an alternative, you may try to use the raw output messages from the "Output" tab, which haven't been filtered by Visual Studio. Either do an in-place search for the strings "error" and/or "failed", or copy all of the output to your favorite text editor and do a search there.
To ensure that the Output window appears each time you do a build, you can go to Tools → Options → Projects and Solutions → General, and ensure that the option "Show Output Window when build starts" is checked.
As an additional troubleshooting step, it is also possible to build the project from the PowerShell command line by running dotnet build. This will show you the complete build output, including any errors that Visual Studio may be hiding.

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.

Here are some things that you can try:
If your solution contains more than one project, try building each project one at a time. (You may even want to try opening each project independently of the solution.)
If applicable, ensure that all of your projects (including dependencies and tests) target the same version of the .NET Framework. (Thanks to user764754 for this suggestion!)
Tip: Check Tools → Extension and Updates to ensure that your packages are up-to-date.
Ensure that all dependency projects are built to target the same platform as your main project.
Try restarting Visual Studio.
As suggested by Bill Yang, try running Visual Studio as Administrator, if you aren't already. (If you are already running Visual Studio as Administrator, perhaps try the opposite?)
Try restarting your computer.
Try "Rebuild All".
Run "Clean Solution", then remove your *vspscc* and *vssscc* files, restart Visual Studio, and then "Rebuild All".
As suggested by Andy, close Visual Studio, delete the .suo file, and restart Visual Studio.
As suggested by Arun Prasad E S, close Visual Studio, delete the .vs folder in your solution directory, and then re-open Visual Studio. (This folder is auto-generated by Visual Studio and contains cache, configuration settings, and more. More details can be found in these questions: Visual Studio - Deleting .vs folder and https://stackoverflow.com/q/48897191.)
As suggested by MrMalith, close Visual Studio, delete the obj folder in your solution directory, clear your temporary folder, and then re-open Visual Studio.

Delete the hidden .vs folder & restart Visual Studio. That worked for me.

I want to expand on Sasse's answer. I had to target the correct version of .NET to resolve the problem.
One project was giving me an error:
"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.

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

I tried many things like restarting Visual Studio, cleaning and rebuilding the solution, restarting the PC, etc., but none of them worked for me. I was finally able to solve the problem by doing the following:
First of all, make sure all the projects in your solution (including tests) are targeting the same .NET version. Then:
Save pending changes in the project and close Visual Studio
Find the exact location from file explorer and find "obj" file and open it,
Then, delete all the included files (some files won't remove, it doesn't matter, just skip them).
Use run command (by pressing Windows Key + R) and type "%temp%" and press enter to find temporary files.
Finally, delete them all.

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.

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:

In my case (VS 2019 v16.11.20), disabling Text Editor->C#->Advanced->Enable 'pull' diagnostics in the options solved the issue.

Double check for _underscore.aspx pages in your project.
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.

Related

Warnings in VS2017 but all fine with VS2015

When load my .NET Frameowrk 4.6.2 solution in Visual Studio 2017, it gives me the following warning:
Severity Code Description Project File Line Suppression State
Warning Your project is not referencing the ".NETFramework,Version=v4.6.2" framework. Add a reference to ".NETFramework,Version=v4.6.2" in the "frameworks" section of your project.json, and then re-run NuGet restore.
Another:
Warning IDE0006 Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled. BigData 1 Active
However, loading in visual studio 2015 is totally fine with the exactly same solution files and structures.
Why is this and how I can solve it?
BTW, from what I read, in the latest updates, project.json is merged back to .csproj, why here it's still recommending something on project.json
I had this show up as an error when building shortly after migrating a solution from vs2015 to 2017, and then also doing some git restructuring. As it turns out, I think git was actually the culprit.
Regardless, manually deleting the bin & obj folders in the affected projects solved it for me. (Clean alone wasn't cutting it.)
Are you sure, you installed all needed packages for your project? It could be a not installed feature. Go in the launcher to modify and check, are there all dependencies installed?

Visual C++ 2010 error. The system cannot find the file specified when running LibICP

There is a code for running libIcp for Andreas Geiger. I downloaded the code, and build the sln based on CMAKELISts.txt. Everything good so far.
According "readme.txt" I Opened the resulting Visual Studio solution with Visual Studio and Switched to 'Release' mode, build all and run the demo program. but 1st this window came up:
And Then I got this error:
Any help is appreciated.
You can not run the ALL_BUILD target it does not create an executable. It is there to force building the entire solution. Select an application target from the solution in Solution Explorer. Right click on that target and click set as start up project. This option should be around in the middle of the popup menu.

Visual Studio Project always out of date, "up to date is missing #ECHO", why is Visual Studio looking for this input?

Background:
My team wants Visual Studio for development on an existing codebase, for its various tools, and that's what most developers are used to using. However, the existing build system (an internal flavor of Jam) is very entrenched, and for a variety of factors cannot be changed.
The idea:
Create a project for each component. I did this using a description generated by Jam of what files go into each library, and making that into a QT project file. I call qmake on this to generate Visual Studio projects with "qmake -tp vc".
Disable Visual Studio's build. I did this by changing the Type of each source file to "does not participate in build" (by changing each to )
Add a pre-build event that calls the Jam build.
Problem:
Now, when I try to build from Visual Studio, it works, in that it calls Jam.
However, I would expect Visual Studio to think the project is always up-to-date, considering it is not actually tracking any source files for compile. But it is always out-of-date, and must call the pre-build command before debugging (which attaches the debugger to the executable, and works just fine).
I used DebugView to see what was going on, and for many of my projects, I get the following in the log
[12900] Project '<my project's name>' is not up to date because 1 build inputs were missing.
[12900] devenv.exe Information: 0 :
[12900] up to date is missing: '<my project's location>\#ECHO'
I've searched high and low, but cannot find any reference to #echo as a file input to anything anywhere. Does anybody know, and/or is there a way to track down why it is looking for this?

Visual Studio 2010 not rebuilding/recompiling

I was working on a project when all of a sudden VS stopped recompiling my project each time I debugged (mid way through working... I never changed anything). So it keeps running the same old build over and over.
I don't want to have to "clean build" each time, and I've followed the instructions here (Visual Studio 2010 doesn't rebuild changed code unless I manually select "Rebuild"). Surprisingly, they were already set (prompt to build when project outdated, build is checked under configuration manager).
However, it still never prompts me (except for after clean), and it's getting really frustrating. I'm using VS c++ if it helps.
I just had the same issue. This might solve your problem:
Tools->Options->Project and Solution->Build and Run.
There is an option what to do for "On run, when projects are out of date". Set this to "always create". This will mean that if you compile a project which depends on another project in your project folder, then the other project is compiled first, just as you want.
In my case, this option was set but then set to something else after a crash of VS2010.

Why is msbuild and link.exe "hanging" during a build?

We have a few C++ solutions and we run some build scripts using batch files that call msbuild.exe for each of the configurations in the solutions.
This had been working fine on 3 developer machines and one build machine, but then one of the projects started to hang when linking. This only happens on the newest machine which is a quad core, 2.8ghz I think. It runs on Windows Server 2003 and the others are on XP or Vista.
This happens consistently even if I change the order of builds in the bat file.
If I run the build from the IDE on that machine it does not hang.
Any ideas about what could possibly be causing this?
I am using Visual Studio 2008.
Edit:
I see now that when it is hung the following are running:
link.exe (2 instances) One with large memory usage and one with a small amount of memory usage.
vcbuild.exe
msbuild.exe
vcbuildhelper.exe
mspdbsrv.exe
Edit:
The exe file exists and so does the pdb file.
The exe file is locked by some process, and I can't delete it or move it. I can delete the pdb file though.
I also have the problem if I just use VCBuild.exe.
I decided to try debugging the 2 link.exe processes and the mspdbsrv.exe processes.
When I attached the debugger/MSdev IDE to them I got a message box saying that the application was deadlocked and/or that "all threads have exited".
I guess I will have to check for a service pack for that msdev install on that machine.
Edit:
In the debug.htm output file I get all sorts of stuff output after the link.exe command is generated.
However, for the release buildlog.htm the linke.exe line is the last line.
This is clearly a hang in the linker. Definitely a Microsoft bug.
I am now trying to figure out what the .rsp (linker response) file is.
When I issue:
link.exe #c:\\Release\RSP00000535202392.rsp /NOLOGO /ERRORREPORT:QUEUE
That is the last line in the release build log. The debug one has lots more information after that.
Reinstalling a different version of Visual Studio did not solve the problem.
I will open an issue/ticket with Microsoft. I will post an answer if I can.
Whole-program optimization (/GL and /LTCG) and /MP don't mix -- the linker hangs. I raised this on Connect.
The upshot is that it's a confirmed bug in VS2008; contact PSS if you want a hotfix; and the fix is included in VS2010.
If you can't wait that long, turn off /MP (slower compiles) or /LTCG (slower code).
Are you using xcopy in your scripts? This suggests wrapping xcopy with cmd /c " .. " as a solution.
If that wasn't it, I'd recommend to narrow things down by only letting one cpu work (i.e. removing /maxcpucount) This would rule out any form of race condition between compilation processes.
I had a similar problem, but with Visual Studio 2010.
This is a project that had worked fine on another computer, but just not my new one.
The symptoms described matched the original Visual Studio 2008 Issue.
I was able to resolve the issue by installing the Visual Studio 2010 Service Pack 1 (SP1)
http://www.microsoft.com/download/en/confirmation.aspx?id=23691
- or just go to microsoft and search for "Visual Studio 2010 Service Pack 1"
I had run my windows "check for updates" and had thought I had installed all service packs, but apparently, I had not installed any Visual Studio Service Packs.
After installing the VS2010 SP1, I no longer had this issue.
I confirmed that I had installed VS2010 and the Service Pack 1 on other older computer with the working project a while back.
You could try this: Open the build dialog via
Menu -> Tools -> Options -> Projects and Solutions -> Build and Run
Here you can set "MSBuild project build output verbosity" to
"Diagnostic". Maybe this will deliver more information on what is
going wrong.
In the same dialog you can set "Maximum number of parallel project
builds" to 1. Maybe this works around the link.exe "hang".
mspdbsrv.exe is used to combine all debug info into one pdb file. The VS2005 version of mspdbsrv.exe is buggy, it might be that the VS2005 version has some of the same issues. Killing it before building is making a difference for some people. We're going to add it to our builds as well since we're regularly suffering from unknown PDB errors.
Have you tried disabling incremental linking, or alternatively, always forcing a Rebuild All?