Why doesn't Visual Studio display warnings generated by the #warning directive (CS1030)?

UPD: Bug fixed in VS 2012.

Edit: I reported this as an error on the Microsoft Connect site here (the page has been deleted).

Edit 2: Microsoft does not fix this error (at least not in VS2010).

User warnings are displayed only in the error list window for one file for each project. Therefore, if you put the #warning directive in several files of your project, you will not see any warnings after assembly for most files. Missed warnings are generated using msbuild and are visible in the Output window, but not in the Error List window.

Note. none of the files containing #warning should be opened in the VS editor at the time of assembly for this effect (VS error?), which will be visible.

How to get all my custom warnings displayed in assembly?

I am using Visual Studio 2008 SP1.

+3
source share
2 answers

I did a little experiment.

  • Created a C # console application and added a second file
  • Added #warning file1 and #warning file2 (one per file)
  • Restore all

In this case, the task list shows only one of the errors. However, if you look at the output window, it displays both compilation errors.

. ?

0

, , .

- .

0

Source: https://habr.com/ru/post/1711306/


All Articles