title: Teamcity, Sonar and C#/.NET
body: <p>We are trying to use Sonar with TeamCity 8.1.5, SonarQube 5.1.2 and the SonarQube runner build step in TeamCity. </p>
  
  <p>Visual Studio 2010, 2012 and 2013 are installed on the build agent.</p>
  
  <p>The solution we try to analyse with SonarQube uses VS2013.</p>
  
  <p>We have a build running where we have tried to use either the MSBuild or Visual Studio build step to build the solution, and then we have a  SonarQube runner step to perform the analysis. </p>
  
  <p>Unless we specify the following as "Additional parameters" to the SonarQube build step:</p>
  
  <pre><code>-Dsonar.cs.fxcop.assembly=PathToDllFromSolution
  -Dsonar.fxcop.installDirectory=C:/Program Files (x86)/Microsoft Visual Studio 12.0/Team Tools/Static Analysis Tools/FxCop
  -Dsonar.cs.fxcop.fxCopCmdPath=C:/Program Files (x86)/Microsoft Visual Studio 12.0/Team Tools/Static Analysis Tools/FxCop/FxCopCmd.exe 
  </code></pre>
  
  <p>we get errors like this:</p>
  
  <pre><code> org.sonar.runner.impl.RunnerException: Unable to execute Sonar
      at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
      at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
      at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
      at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
      at org.sonar.runner.api.Runner.execute(Runner.java:100)
      at org.sonar.runner.Main.executeTask(Main.java:70)
      at org.sonar.runner.Main.execute(Main.java:59)
      at org.sonar.runner.Main.main(Main.java:53)
  Caused by: java.lang.IllegalArgumentException: The property "sonar.cs.fxcop.assembly" must be set and the project must have been built to execute FxCop rules. This property can be automatically set by the Analysis Bootstrapper for Visual Studio Projects plugin, see: http://docs.codehaus.org/x/TAA1Dg.If you wish to skip the analysis of not built projects, set the property "sonar.visualstudio.skipIfNotBuilt".
      at org.sonar.plugins.fxcop.FxCopConfiguration.checkMandatoryProperties(FxCopConfiguration.java:105)
  </code></pre>
  
  <p>What do we have to do to avoid having to use the -D for assembly analysis?</p>
  
  <p>Attaching screenshots of configuration:
  <a href="https://i.stack.imgur.com/BSfZ3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BSfZ3.png" alt="Build steps"></a>
  <a href="https://i.stack.imgur.com/b1D9E.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b1D9E.png" alt="SonarQube step"></a></p>