DCSIMG
Debugging in MSBuild - IHateSpaghetti {code}

IHateSpaghetti {code}

VSX, DSL and Beyond by Eyal Lantzman

Syndication

Coding / Architecture

Extensibility /DSL

Projects

Articles

Debugging in MSBuild

There's a nice switch in MSBuild:

/verbosity:level

The available verbosity levels are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]. /v is also acceptable.

For example:

msbuild /v:diag

This way there's a lot of extra info that is generated for you and hopefully should help your debugging. 

However there's another way - you can create a task that will just output the stuff you wan't to debug. I used it when I had to check why our custom code analysis wasn't working as we expect it to work:

First of all you need to make sure that you build is depends on something (this case BuildDependsOn) :

<Target Name="Build" DependsOnTargets="$(BuildDependsOn)"/>

 Now we can add custom actions:

<PropertyGroup> 
<BuildDependsOn>$(BuildDependsOn); EyalDebugMessage</BuildDependsOn>
</PropertyGroup>
 

And here's the actual custom action (will print out all the rules):

<Target Name="EyalDebugMessage">   
<Message Condition="$(RunCodeAnalysis)'=='true'" Text="Rules: $(CodeAnalysisRules)"/>

</Target>

 

Now you can search the output for "EyalDebugMessage and see all the rules

Published Tuesday, October 07, 2008 10:06 AM by Eyal
תגים:, ,

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: