Double warning compilation

I have a WPF project, and compiling with Visual Studio / MSBuild seems to do 2 passes, with the latter transferring several temporary resource files, for example.

csc <options> <files>
csc <options> <files> /resource:obj\Debug\Project.g.resources

I suspect you cannot get around this (at least without refusing to generate code or XAML). But the problem I am facing is that every warning about the compiler doubles. Worse, they are in different languages! For example, for me in English and German, in the first walkthrough generating warnings in English, and in the second German warning:

 5  The event 'SomeEvent' is never used           Foo.xaml.cs  29
 8  Unreachable code detected                     Bar.cs       33
34  Unerreichbarer Code wurde entdeckt.           Bar.cs       33
44  Das Ereignis "SomeEvent" wird nie verwendet.  Foo.xaml.cs  29

Obviously, this creates a lot of noise.

Is this normal behavior or am I doing something wrong here? Are there any ways to improve this? It should show each warning only once, preferably in English. But everything in German is enough too.

+3
source share
2 answers

When your XAML link types are defined in one project (for example, xmlns: local = "..."), then the MSBuild process creates a temporary project to create types so that the XAML compiler can correctly generate BAML and / or partial support.

You can fix your messages with a double error by moving these types to another assembly that will be compiled before your XAML project.

, .

+2

Gix,

, , ? , /nowarn, .

.

0

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


All Articles