Reputation: 6353
Visual Studio 2008 shows a lot of erroneous errors when building a website (not a web project) in the errors list. These errors are usually corrected (removed) when I rebuild the site a couple times but they cost me wasted time.
Is there anyway to hide the erroneous errors?
Update: I've decided to look into this to see if I could reproduce it. This is the exact behavior I am seeing, using the website model, I type some invalid syntax on a page. The errors list fills up with errors. I correct the error and the errors list does not update. I build the project and the errors list still shows the errors but the build shows as build completed. I build the project a second time and the errors list is cleared.
My question is there anyway to make the errors list clear on the first build? I thought it might have something to do with page build vs website build but it seems to make no difference. I am not using any third party dlls on this website.
Upvotes: 3
Views: 335
Reputation: 2873
I've seen this exact problem in both VS2010 and 2012.
I think it's due to a combination of inappropriate file encoding and/or badly encoded characters in the web.config file.
I pasted a folder path into the value property of an appSetting entry without spotting it contained an ampersand. The ampersand should of course have been encoded as "&".
The web.config file also had the "UTF-8 without signature" encoding. Although the VS IDE can work with this, it's not necessarily going to be understood by the .net compiler (see this answer: https://stackoverflow.com/a/8587278/1499294).
In Visual Studio you can change the file encoding by going to "Save [filename] As..." and clicking on the little down arrow on one end of the Save button. The "UTF-8 with signature" (Codepage 65001) option seems to be a better bet.
Upvotes: 0
Reputation: 13509
I can't be sure that this is your case, but I have seen this be done before when you have multiple projects in your solution that have references to one another. When doing so, your build order must be correct. If this is the case, right-click on your solution in the Solution Explorer and select "Project Dependencies..." and make sure this looks right.
Upvotes: 1
Reputation: 38392
Without knowing what errors your are getting, this sounds maybe like you have some web server controls that are in a seperate project, and the order in which the projects are being compiled is causing the errors. I.e. the main project is compiled, generates errors because it can't find web controls or other dependencies, and then the other projects are compiled, so that when you compile the second time the dependencies exist and the main project compiles successfully.
Edit: When you right click the Solution(not the project) in solution explorer, and choose Properties, there is a Project Dependencies page that lets you specify the dependencies of each project. Make sure that this is accurate in terms of what is using what. Also be wary of circular dependencies.
Upvotes: 0
Reputation: 3652
This probably has to do with the way you reference your projects. If you are referencing them as DLLs instead of projects, after a clean you will get missing reference/undef. symbols errors until you build them.
Upvotes: 1