views:

124

answers:

2

On our continous integration server (Teamcity 5.1.3) we have a msbuild script that is automatically building our applications.

When we enable "Warning as error": in Visual Studio, it build fine (it ignores the methods within "*.designer.cs" files. But on the build server we always receive the following error:

[(Rebuild target(s)):] somefile.Designer.cs(XX, XX): error CS1591: Warning as Error: Missing XML comment for publicly visible type or member...

The MSBuild script that is being used looks like this:

<MSBuild Projects="proj\$(ProjectName).sln"
         Targets="Clean;Rebuild"
         Properties="Configuration=Release"
         StopOnFirstFailure="True">
</MSBuild>

I can understand why it does that, but there must be a way to tell msbuild to ignore missing comments in generated files?

EDITED

Digging a little further: In the Visual Studio Solution we had "Warning as error" checked but we also add error 1591 listed in the "Suppress warning" textbox. MSBuild does'nt seem to pick up that "suppress warning" textbox and fails the build. Anything I can do?

EDITED Again The problem was that MSBuild was targetting any CPU (and in the "ANY CPU" configuration we didnt suppressed error 1591). Once we changed ANY CPU to exclude error 1591 it all started to build correctly on the build server. Thanks for those that helped.

+1  A: 

No, MSBuild isn't picky about XML comments. Whatever code analysis tool you use is. Guessing at something like StyleCop. It does complain about this exact problem, it's not very smart, about on par with the Windows Forms project templates.

You are only ever going to solve this problem if you enforce the same kind of build rules on the devs as you apply to the build server. Because it will take one of them to edit the do-not-edit code that it is in a Mumble.Designer.cs file and apply the [GeneratedCode] attribute. It is not there now.

That's a political problem, one I cannot really help you with. Nor the Microsoft groups that worked on this at different times and different buildings. But you can count on the devs barking loudly if you ask them to solve the problem.

Make it consistent.

Hans Passant
I have edited my question to reflect the new informations I found. Altough I'm still a little puzzled, your answer helped me dig in the right direction.
Benoittr
Even tough the answer wasnt answering directly the question (and my question wasnt totally clear at first... see the edits) I went ahead and accepted your answer since somehow it lead me to the answer I wanted.
Benoittr
+1  A: 

You can ignore comments warning by adding the following property in your msbuildcall : nowarn="1591,1573".

<MSBuild Projects="proj\$(ProjectName).sln"
     Targets="Clean;Rebuild"
     Properties="Configuration=Release;nowarn=1591,1573"
     StopOnFirstFailure="True">
</MSBuild>
Benjamin Baumann