Visual Studio 2010 says Build failed with no errors after I change a source file
Asked Answered
K

17

64

I have a Visual Studio 2010 solution with a few projects. I can successfully build with Build -> Build Solution or Build -> Build MyCompany.MyProduct.MyProject. After building I press CTRL+F5 and successfully run the start up project. This works as expected.

After I change a source file, save it and then again build (with either Build -> Build Solution or Build -> Build MyCompany.MyProduct.MyProject) it builds successfully. I am still able to press CTRL+F5 and run the startup project. This again works as expected.

The problem is in the following scenario: After I change a source file, save it and directly press CTRL+F5 then Visual Studio 2010 says BUILD FAILED and there are no errors. And it doesn't start my startup project (of course).

Am I missing something?

Kreutzer answered 21/2, 2011 at 15:47 Comment(4)
Might not hurt to clean the project and rebuild if that error keeps happening consistently. If it's all of your projects, then that would imply an underlying problem that I'm ill-equipped to diagnose.Alcatraz
Copy and paste the content of the Output window into your question.Preachy
I closed and reopened Visual Studio and also deleted the output folder of some of the projects (3 of them have it shared) and the problem disappeared. I think it will reappear though and I'll paste the output window's content.Kreutzer
Gopi's answer helped... Copied the files to a different folder with a smaller path length.Huebner
H
109

Close Visual Studio, delete the .suo file for your solution. It's a 'hidden file' in Windows and contains user preferences, but it can also do nasty things.

Hereunto answered 27/6, 2011 at 10:22 Comment(4)
downloaded project from tfs on a new box, wouldnt compile, no error displayed, delete suo, builds fineSpasm
Didn't work for me. I had to delete a reference to a project in the same solution, and added it again. Then it worked!Congest
For future reference, it's a .user file in VS 2015 but worked just as well for me. Thanks.Chavannes
For Visual Studio 2015, I deleted the .vs directory and then it started working.Slavonic
A
21

Seems a bit late, but what worked for me was to check my Output window.

I had a reference to a Function that didn't exist yet. I don't know why it never came up in the Error List, but the Output window told me exactly where the problem was.

Affair answered 12/6, 2012 at 9:8 Comment(2)
Output window is found under the debug menu.Ontology
Yep this was what worked for me - a missing #endregion didnt' show up in Errors, but was visible in Output. Thanks Ortund.Baecher
R
13

Try repeating the same steps by changing the location where you compile/run. Make sure your new location has less folders to traverse when compared to your old location. A lengthy path to the source code had resulted in a similar issue to me and I overcame it by choosing a shorter path.

Reformation answered 27/6, 2011 at 8:50 Comment(3)
This worked for me. Over time the folder name got longer and longer without consequence.Walker
You saved me hours, I never would have guessed to build it from somewhere else.Graniteware
Thanks! This solved it for me :) spent a while trying to work out what the problem was, bit annoying VS doesn't state the issue.Cranford
O
8

I closed my visual studio.

Deleted every bin folder. (I had a weird permission error, so I deleted the files and back track deleted the folders including bin).

Reopened visual studio. Performed build or rebuild and everything was working again.

Ontology answered 4/12, 2013 at 2:51 Comment(0)
P
3

Check your project physical path , If is to long , Copy project to some root directory folder with very short name. And try to build your project.

Paramedical answered 10/11, 2014 at 10:45 Comment(0)
M
2

I had this problem and had one warning but couldn't find any errors. Eventually I copied the build command from the output window into a command window and ran it manually - it spat out four errors after the warning. I have no idea why this worked.

The command required should be labelled "CoreCompile" and look something like this: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702,2008 /nostdlib+ /errorreport:prompt /warn:4 /define:TRACE;SILVERLIGHT;WINDOWS_PHONE /errorendlocation /preferreduilang:en-US /highentropyva- /reference:"C:\Dropbox\code

If you don't see it, try changing your build output settings under Tools->Options->Projects and Solutions->Build and Run, set "MSBuild project build output verbosity" to Normal or higher.

Madison answered 12/1, 2015 at 9:5 Comment(0)
R
1

In case some other folks are experiencing this issue (I had tried deleting the SUO file first but this didn't work for me):

I solved it by creating a blank new Project in my solution and importing all source files into the new project. Likely the problem sat in project file.

Rapturous answered 24/10, 2012 at 17:32 Comment(0)
I
1

I had the same problem, solved by the following step

go to Tool->option->projects and Solution->General, make sure to check the box "Always show Error List if build finishes with errors", in this case, visual studio will show the error list.

Ichneumon answered 13/7, 2015 at 21:20 Comment(0)
T
0

In my case I did not see a Code Contracts bug in the output window:

CodeContracts: xxx: Unhandled Exception: System.IO.FileNotFoundException:
Could not load file or assembly 'System.Data.SqlServerCe, Version=3.5.1.0,
Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies.
The system cannot find the file specified.

I solved it by disabling Cache Results in the Code Contracts windows for that project, as suggested in this answer.

Terrieterrier answered 8/1, 2013 at 1:54 Comment(0)
C
0

I was working on a web site project that referenced a library project (in the same solution) when I ran into this issue. Build failed while the editor was highlighting syntax and navigating to the source. Very frustrating.

None of the other answers worked for me; I thought this issue might be related as I recently used DBML for the first time on this machine. Still not entirely sure it wasn't a contributing factor.

After cleaning solution, temp files, restarting VS, etc., I ended up excluding the 2 offending files, which allowed the solution to build successfully, then when I included them again everything built correctly.


p.s. I later discovered an error in the website's masterpage codebehind (referencing an enum value that had been removed), which was not being displayed as an error. I've had errors in masterpage codebehind cause (apparently) unrelated problems before; I try to remember to check there when a simple solution doesn't present itself.
Corrincorrina answered 26/1, 2013 at 0:59 Comment(0)
A
0

My issue arose from converting a functional vs2008 project to vs2010. All other projects in the solution came across fine, but this one would build the MIDL portion, then stop and fail. Detailed build setting revealed nothing, so finally I created a whole new project with all files the same. This worked. Then I compared the settings, and finally after changing the various parts to match, I discovered that the converted project had MIDL->General -> "MkTypeLib Compatible" set to blank. This was a valid setting in vs2008 apparently, but in vs2010, it apparently must be set to Yes or No (or inherit).

This has fixed my issue.

Altis answered 5/2, 2013 at 21:46 Comment(0)
B
0

if your solution contains too many projects ,

build projects individually,

Check which project is failing

for that project check the references of that project , if on any reference if their is yellow color mark, then delete that reference , and add that again , then build and check,

this will work

or

check in output window , each line , in some line it may be showing , dependency is their , but didnt found it , that is the problem causing

this may be due to file corruption

Brainstorm answered 19/5, 2014 at 9:9 Comment(0)
G
0

Has this issue when dealing with Sharepoint 2013 Workflows in VS 2013. To solve it did the following:

  1. Unload worklfows ( the buggy one) project.
  2. Delete .csproj.user file
  3. Opened .csproj file in the notepad and delete the following lines:

     <PropertyGroup>
      <VisualStudioVersion Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '11.0'">11.0</VisualStudioVersion>
     <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
    

After RELOADING project into solution, the VS added exactly the same lines AGAIN, but no LoaderException issues now.

Gilliland answered 30/5, 2014 at 7:58 Comment(0)
C
0

I had this issue today as well... after changing the verbosity of build to diagnostic like @Jac suggested, i discovered that the problem relies in one my resx files. Apparently, one image was corupted or was too big, i deleted it and it worked!

Carousal answered 30/9, 2015 at 14:19 Comment(0)
C
0

I faced that problem two days ago. I checked on Windows output and I founded there was a missing reference to VBIDE: Cannot find wrapper assembly for type library VBIDE. I showed all files on the solution explorer, expanded references and I found there was a reference to that assembly. I do not know how that reference came into my project and I was sure I did not need it. I just removed it and everything was fixed.

Comrade answered 6/1, 2016 at 20:25 Comment(0)
A
0

Another thing to check is that if any of your source files are open it will not be able to build. I had to restart my computer.

Allieallied answered 7/7, 2017 at 9:59 Comment(0)
L
0

Some times if the Directory path is more than 248 chars it will fail the Solution. Make sure complete path is less than that.I have faced the same issue than i made short and it did worked for me.

Regards Venkateshwarlu, MSBI Developer, Hyderabad.

Lubricous answered 19/7, 2018 at 6:38 Comment(1)
How is this one different from other answers (especially the accepted one)?Handpick

© 2022 - 2024 — McMap. All rights reserved.