Integration is painlessThrough early morning fog I see
visions of the things to be
the pains that are withheld for me
I realize and I can see...
Thanks to everyone who contributed to these links.FxCop and when to fail the buildMSBuild Tasks DocuemtationNCover and CC.Net can be friendsCC.Net running a MSBuild ProjectTypeMock, NUnit and NCover Together in MSBuildTypeMock and MSBuildHere is my final working copy.<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Coverage;CoverageReports;FxCop" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Import the MSBuild Tasks -->
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" />
<Import Project ="C:\Program Files\Typemock\Isolator\5.1\TypeMock.MSBuild.Tasks"/>
<UsingTask TaskName="NCover" AssemblyFile="c:\NCover\Tasks\NCoverExplorer.MSBuildTasks.dll" />
<UsingTask TaskName="NCoverExplorer" AssemblyFile="c:\NCover\Tasks\NCoverExplorer.MSBuildTasks.dll" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<ClassLibraryOutputDirectory>bin\$(Configuration)</ClassLibraryOutputDirectory>
<TestOutputDirectory>\localbin\Course.Web.Ui.TakeExam.Test_Library</TestOutputDirectory>
<ProjectDir>C:\Projects\Web\UI</ProjectDir >
<TestProjectDir>C:\Projects\Test</TestProjectDir >
<ProjectFile>$(ProjectDir)\Course.Web.UI.TakeExam_Site.csproj</ProjectFile >
<TestProjectFile>$(TestProjectDir)\Src\Course.Web.Ui.TakeExam.Test_Library.csproj</TestProjectFile >
<CoverageResults>C:\Program Files\CruiseControl.NET\webdashboard\results</CoverageResults>
<CoverageReports>C:\Program Files\CruiseControl.NET\webdashboard\reports</CoverageReports>
<NCoverPath>C:\Program Files\NCover</NCoverPath>
<NCoverExe>$(NCoverPath)\ncover.console.exe</NCoverExe>
<NUnitPath>C:\Program Files\NUnit 2.4.7\bin</NUnitPath>
<NUnitExe>$(NUnitPath)\nunit-console.exe</NUnitExe>
<FxCopPath>C:\Program Files\Microsoft FxCop 1.35</FxCopPath>
<FxCopRulePath>C:\Program Files\FxCop\CodingStandards\bin\Debug</FxCopRulePath>
</PropertyGroup>
<!-- Build projects by calling the Project files generated by VS -->
<Target Name="Build">
<!--<MSBuild Projects="$(ProjectFile)" />-->
<MSBuild Projects="$(TestProjectFile)" />
</Target>
<!--run FxCop-->
<ItemGroup>
<FxCopRuleAssemblies Include="$(FxCopRulePath)\CodingStandards.dll" />
</ItemGroup>
<ItemGroup>
<FxcopTargets Include="$(TestProjectDir)$(TestOutputDirectory)\Course.Web.Ui.TakeExam.dll" />
</ItemGroup>
<ItemGroup>
<FxCopDependencies Include="C:\3rdparty"/>
<FxCopDependencies Include="$(MSBuildCommunityTasksPath"/>
<FxCopDependencies Include="C:\assemblies"/>
</ItemGroup>
<PropertyGroup>
<FxCopCriticalErrors>0</FxCopCriticalErrors>
<FxCopErrors>0</FxCopErrors>
<FxCopCriticalWarnings>0</FxCopCriticalWarnings>
</PropertyGroup>
<Target Name="FxCop" DependsOnTargets="Build">
<!--<XmlRead ContinueOnError="True"
XmlFileName="$(CoverageResults)\fxcop.xml"
XPath="string(count(//Issue[@Level='CriticalError']))">
<Output TaskParameter="Value" PropertyName="FxCopCriticalErrors" />
</XmlRead>
<XmlRead ContinueOnError="True"
XmlFileName="$(CoverageResults)\fxcop.xml"
XPath="string(count(//Issue[@Level='Error']))">
<Output TaskParameter="Value" PropertyName="FxCopErrors" />
</XmlRead>
<XmlRead ContinueOnError="True"
XmlFileName="$(CoverageResults)\fxcop.xml"
XPath="string(count(//Issue[@Level='CriticalWarning']))">
<Output TaskParameter="Value" PropertyName="FxCopCriticalWarnings" />
</XmlRead>
<Error Text="FxCop encountered rule violations."
Condition="$(FxCopCriticalErrors) > 0 or $(FxCopErrors) > 0 or $(FxCopCriticalWarnings) > 0" />-->
<FxCop
TargetAssemblies="@(FxcopTargets)"
RuleLibraries="@(FxCopRuleAssemblies)"
AnalysisReportFileName="$(CoverageResults)\fxcop.xml"
DependencyDirectories="@(FxCopDependencies)"
FailOnError="False"
Verbose="True"
IncludeSummaryReport="True"
/>
</Target>
<ItemGroup>
<TestAssembly Include="$(TestProjectDir)$(TestOutputDirectory)\Course.Web.Ui.TakeExam.Test_Library.dll" />
</ItemGroup>
<!-- Run Unit tests -->
<!--The Coverage task will also run the unit tests - use this one if you only need to run the unit tests-->
<Target Name="UnitTests" DependsOnTargets="Build">
<CallTarget Targets="StartTypeMock"/>
<Exec ContinueOnError="false" Command='"$(NUnitExe)" @(TestAssembly) /include=UnitTest /out="$(CoverageResults)\TestResult.xml"'/>
<CallTarget Targets="StopTypeMock"/>
<OnError ExecuteTargets="StopTypeMock"/>
</Target>
<ItemGroup>
<CoverageAssemblies Include="$(TestProjectDir)$(TestOutputDirectory)\Course.Web.Ui.TakeExam.dll" />
</ItemGroup>
<Target Name="Coverage" DependsOnTargets="Build">
<CallTarget Targets="StartTypeMock"/>
<NCover
ToolPath="$(NCoverPath)"
CommandLineExe="$(NUnitExe)"
CommandLineArgs="@(TestAssembly) /noshadow /include=UnitTest"
WorkingDirectory="$(CoverageResults)"
CoverageFile="$(CoverageResults)\Coverage.xml"
LogFile="$(CoverageResults)\Coverage.log"
Assemblies="@(CoverageAssemblies)"
ProfileIIS="false"/>
<CallTarget Targets="StopTypeMock"/>
<OnError ExecuteTargets="StopTypeMock"/>
</Target>
<!--This will create the reports-->
<ItemGroup>
<CoverageFile Include="$(CoverageResults)\Coverage.xml" />
</ItemGroup>
<Target Name="CoverageReports" DependsOnTargets="Coverage">
<!--ToolPath property is NOT in the online documents - only in the examples-->
<NCoverExplorer
ToolPath="$(NCoverPath)"
ProjectName="Take Exam Refactor"
CoverageFiles="@(CoverageFile)"
OutputDir="$(CoverageReports)"
ReportType="ModuleClassFunctionSummary"
SatisfactoryCoverage="80"
FailMinimum="False"
XmlReportName="CoverageSummary.xml"
HtmlReportName="CoverageSummary.html" />
</Target>
<Target Name="StartTypeMock">
<TypeMockStart Link="NCover2.0" LogPath="$(CoverageResults)"/>
</Target>
<Target Name="StopTypeMock">
<TypeMockStop />
</Target>
</Project>