MSBuild and FxCop (CodeAnalysis) as the same build runner

Hi,

I am new to team city.

I know that it is possible to run an MSBuid and FxCop as two seperate build runners, I have set this up and it works fine. However, my MSBuild script already has a "RunCodeAnalysis" target which runs as part of the build, VS2010 sets this up automatically. Is it possible to treat this as if it were the FXcop build runner? I.e. running the MSBuild script should show the "Code Inspection" tab once it has run. Having to run a seperate FxCop build runner seems redundant to me as MSBuild has already run code analysis.

Below is an example of log messages when I run the MSBuild build runner.

Cheers,
Liam

[Web\MFN.SoMa.Web.csproj] RunCodeAnalysis (11s)

[09:45:18]: [RunCodeAnalysis] CodeAnalysis (11s)
[09:45:18]: [CodeAnalysis] Running Code Analysis...
[09:45:18]: [CodeAnalysis] C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\FxCopCmd.exe /outputCulture:1033 /out:"bin\MFN.SoMa.Web.dll.CodeAnalysisLog.xml" /file:"bin\MFN.SoMa.Web.dll" /reference:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Frameworks\AncestrySearchAPI\Ancestry.Service.AugPlaceService.dll" /reference:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Frameworks\AncestrySearchAPI\Ancestry.Service.PersonRank.dll" /reference:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Frameworks\AncestrySearchAPI\Ancestry.ServiceContracts.PersonModel.dll" /reference:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Frameworks\AncestrySearchAPI\Ancestry.ServiceContracts.PersonSearch.dll" /reference:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Frameworks\AncestrySearchAPI\Ancestry.ServiceContracts.PlaceAuthority.dll" /reference:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Frameworks\Ancestry\MFN.Shared.ExceptionManagement.dll" /reference:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Frameworks\AncestryServiceAPI\MFN.Shared.IntlBasic.dll" /reference:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Frameworks\AncestryServiceAPI\MFN.Shared.ServiceApi.GenDatabase.dll" /reference:"C:\TeamCity\buildAgent\work\93b158ec08e92022\DomainModel\bin\DEV\MFN.SoMa.DomainModel.dll" /reference:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Repositories\bin\DEV\MFN.SoMa.Repositories.dll" /reference:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Frameworks\Unity\Microsoft.Practices.Unity.Configuration.dll" /reference:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Frameworks\Unity\Microsoft.Practices.Unity.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll" /reference:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Frameworks\MvcSiteMap\MvcSiteMap.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.ComponentModel.DataAnnotations.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Configuration.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Drawing.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.Abstractions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.ApplicationServices.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.Extensions.dll" /reference:"C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 2\Assemblies\System.Web.Mvc.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.Routing.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.Linq.dll" /reference:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Frameworks\Ancestry\TGN.SS.Services.Ucdm.dll" /reference:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Frameworks\WebSiteScreenShot.com\WebsitesScreenshot.dll" /directory:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Frameworks\Ancestry" /directory:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Frameworks\MvcSiteMap" /directory:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" /directory:"C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 2\Assemblies" /directory:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Frameworks\WebSiteScreenShot.com" /directory:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Frameworks\AncestryServiceAPI" /directory:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Repositories\bin\DEV" /directory:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Frameworks\AncestrySearchAPI" /directory:"C:\TeamCity\buildAgent\work\93b158ec08e92022\DomainModel\bin\DEV" /directory:"C:\TeamCity\buildAgent\work\93b158ec08e92022\Frameworks\Unity" /ruleSet:"=C:\TeamCity\buildAgent\work\93b158ec08e92022\Web\..\CA Rules.ruleset" /rulesetdirectory:"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets" /rulesetdirectory:"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets" /rule:"-C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules" /rule:"-C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules" /searchgac /ignoreinvalidtargets /forceoutput /successfile /ignoregeneratedcode /saveMessagesToReport:Active /timeout:120
[09:45:29]: [CodeAnalysis] CA1716 : Microsoft.Naming : Rename namespace MFN.SoMa.Web.ViewModels.Shared so that it no longer conflicts with the reserved language keyword 'Shared'. Using a reserved keyword as the name of a namespace makes it harder for consumers in other languages to use the namespace.
[09:45:29]: [CodeAnalysis] CA1053 : Microsoft.Design : Because type 'ConfigSettings' contains only 'static' members, mark it as 'static' to prevent the compiler from adding a default public constructor.
[09:45:29]: [CodeAnalysis] c:\TeamCity\buildAgent\work\93b158ec08e92022\Web\ConfigSettings.cs(25, 0): CA1056 : Microsoft.Design : Change the type of property 'ConfigSettings.BaseUrl' from string to System.Uri.
[09:45:29]: [CodeAnalysis] c:\TeamCity\buildAgent\work\93b158ec08e92022\Web\Extensions.cs(277, 0): CA1031 : Microsoft.Design : Modify 'Extensions.IsInternalIP(this HttpRequestBase)' to catch a more specific exception than 'Exception' or rethrow the exception.
[09:45:29]: [CodeAnalysis] c:\TeamCity\buildAgent\work\93b158ec08e92022\Web\Extensions.cs(272, 0): CA1031 : Microsoft.Design : Modify 'Extensions.IsInternalIP(this HttpRequestBase)' to catch a more specific exception than 'object' or rethrow the exception.
[09:45:29]: [CodeAnalysis] c:\TeamCity\buildAgent\work\93b158ec08e92022\Web\Extensions.cs(99, 0): CA1502 : Microsoft.Maintainability : 'Extensions.ToRouteValueDictionary(this IPerson, List<string>)' has a cyclomatic complexity of 28. Rewrite or refactor the method to reduce complexity to 25.
[09:45:29]: [CodeAnalysis] c:\TeamCity\buildAgent\work\93b158ec08e92022\Web\Extensions.cs(99, 0): CA1002 : Microsoft.Design : Change 'List<string>' in 'Extensions.ToRouteValueDictionary(this IPerson, List<string>)' to use Collection<T>, ReadOnlyCollection<T> or KeyedCollection<K,V>
[09:45:29]: [CodeAnalysis] CA1813 : Microsoft.Performance : Seal 'LocalizedDisplayNameAttribute', if possible.
1 comment

TeamCity does not support implicit FxCop from MSBuild support. You may add TeamCity service message into your build script with FxCop report file path to make TeamCity publish inspections. Please see http://confluence.jetbrains.net/display/TCD5/FxCop_#FxCop_-UsingServiceMessages for more details.

0

Please sign in to leave a comment.