Reset to default
Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.
It falls back to sorting by highest score if no posts are trending.
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
*vssscc*files, restart Visual Studio, and then “Rebuild All“.
- As suggested by Andy, close Visual Studio, delete the
.suofile, and restart Visual Studio.
- As suggested by Arun Prasad E S, close Visual Studio, delete the
.vsfolder 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
objfolder in your solution directory, clear your temporary folder, and then re-open Visual Studio.
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:
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.
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.