I followed the explanations and then I modified a build template to launch stylecop checks after the compilation.
StyleCop 126.96.36.199 has been installed on my build server.
Here is the build results :
Find *.cs files in source tree
About to run StyleCop with C:\Builds\6\DemoTFS2010\styleCop.ITE_Studio\Sources\ITE_Studio\Settings.StyleCop
Create Work Item
TF42095: Failed to update 'Priority' field. Error message: TF26027: A field definition Priority in the work item type definition file does not exist. Add a definition for this field or remove the reference to the field and try again.
Associate Changesets and Work Items
TF42097: A work item could not be created due to a field error. The following fields have incorrect values: Field: 'Reason' Value: 'Build Failure'
Skipped execution of Revert Workspace because of BuildReason Manual
Any ideas ?
Dec 20, 2011 at 8:45 AM
It seems you have two problems, the first one is in using StyleCop which seems to raise an exception. When this exception is catched, there is a second problem when creating a work item to indicate build failure. It seems your Bug work item definition
does not include a Priority field and it doesn not contains a Build Failure value for the Reason field.
I would suggest you first correct the work item problem or disable creating a work item on build failure. You should then see the StyleCop error. Also please check if the TreatWarningAsError is set to true on the StyleCop activity, this would stop StyleCop
on the first violation and raise an exception.
you were right!
Firstly, the bug work item definition had not the same fields as in the sample. Secondly, I forgot to put results of the
FindMatchingFile activity in the styleCopFiles variable so that it was null and the exception occured.
But, after that, there was one problem again : Could not load file or assembly 'StyleCop, Version=188.8.131.52, Culture=neutral, PublicKeyToken=f904653c63bc2738' or one of its dependencies . The
Version control path to custom assemblies has been configured correctly but StyleCop dlls were not committed.
Now, everything is perfect.
Thanks a lot