I have some cs files in my project that are not set to be built (Properties -> Build Action = None). They contain bits of code that don't compile as a whole and are there merely for reference. I don't care about any compilation errors in them, but they appear in the "Error List" window. The errors don't stop compilation, merely clutter the window. Is there some way to tell VS to ignore errors in that file? Or in all files not set to be built, at that ?
I'm using VS 2010
Thanks
To reproduce this:
- Create a new C# project.
- Add a new .CS file to the project. Type some garbage in between the
class Class {
and the closing}
. - Don't build the proj开发者_如何学JAVAect
- Note that the Error List window says something like "Invalid token '}' in class, struct, or interface member declaration".
- Set the Build Action for the .CS file to "None".
- Notice that the Error List still displays the error.
That doesn't make a heckofalot of sense, can't repro it. What version of VS? Are you sure these aren't IntelliSense errors? Another way to tackle it is right-clicking the file in the Explorer window, Exclude from Project. Then click the Show all Files icon (top of window) to make it visible again.
精彩评论