Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6069355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:48:50+00:00 2026-05-23T09:48:50+00:00

I have inherited a solution file that uses a MSBuild script to compile multiple

  • 0

I have inherited a solution file that uses a MSBuild script to compile multiple solutions. The majority of projects are configured with analysis and rulesets and I have a few unit-test projects that don’t.

Projects with analysis turned on:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
  <DebugSymbols>true</DebugSymbols>
  <DebugType>full</DebugType>
  <DefineConstants>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
  <Optimize>false</Optimize>
  <OutputPath>bin\Debug</OutputPath>
  <PlatformTarget>x86</PlatformTarget>
  <CodeAnalysisRuleSet>..\OurRules.ruleset</CodeAnalysisRuleSet>
  <RunCodeAnalysis>true</RunCodeAnalysis>
 </PropertyGroup>

Projects with analysis turned off:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
  <DebugSymbols>true</DebugSymbols>
  <DebugType>full</DebugType>
  <DefineConstants>DEBUG;TRACE</DefineConstants>
  <Optimize>false</Optimize>
  <OutputPath>bin\Debug</OutputPath>
  <PlatformTarget>x86</PlatformTarget>
  <RunCodeAnalysis>false</RunCodeAnalysis>
 </PropertyGroup>

When I run my build script, it looks like some projects are not respecting the project settings:

msbuild.exe BuildScript.proj /p:SolutionRoot=%cd%; /p:Configuration=Debug /p:Platform:x86 /p:RunCodeAnalysis=True

When I check the output folder, I see coverage analysis xml outputs for projects that have the RunCodeAnalysis flag set to false. Can someone help me understand what’s going on here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:48:51+00:00Added an answer on May 23, 2026 at 9:48 am

    I figured this out shortly after posting it.

    Team Build supports the following values for RunCodeAnalysis: Always, Default, Never.

    In contrast, locally MSBuild supports True or False for RunCodeAnalysis.

    Why are they different? In looking at the Microsoft.TeamFoundation.Build.targets file, the following appears:

    <Target Name="CoreCompileSolution">
       <PropertyGroup>
         <CodeAnalysisOption Condition=" '$(RunCodeAnalysis)'=='Always'">RunCodeAnalysis=true</CodeAnalysisOption>
         <CodeAnalysisOption Condition=" '$(RunCodeAnalysis)'=='Never'">RunCodeAnalysis=false</CodeAnalysisOption>
       ...
       </PropertyGroup>
       ...
    </Target>
    

    These settings are then passed onto the msbuild process when it compiles the solution file.

    So in other words:

    Always tells MSBuild to compile all projects with RunCodeAnalysis=True

    Never tells MSBuild to suppress code analysis (RunCodeAnalysis=False) on all projects.

    …and not specifying a value for RunCodeAnalysis means that MSBuild will respect the RunCodeAnalysis setting in the project file. Hence, the default setting.

    Simply removing the /p:RunCodeAnalysis from my original question had the correct result. Projects that have analysis turned on will run code analysis. Projects without the setting don’t perform any extra work.

    More information about this is available here: http://www.bryancook.net/2011/06/build-server-code-analysis-settings.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have inherited a reasonable sized ASP.net solution that has no automated tests. The
I have inherited a project that uses LLBLGen Pro for the DB layer. The
I have inherited a VB6/Access application that we have developed and sold for many
I have inherited a poorly written web application that seems to have errors when
We have inherited an ant build file but now need to deploy to both
I have inherited a C# application, it is made up of 4 solution files
I have inherited a Windows Forms application and I have found that a .EXE
I have a solution-file with ASP.NET Web Sites. When I build the solution with
I've inherited a BizTalk 2006 application that uses several SOAP ports to request data
I have a Solution with a Project which uses a MSSQL Database and generated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.