title: Building Database Project deployment with MSBuild via code is considerably longer in Debug than in Release
body: <p>I am using the MSBuild engine to run a deployment on Team Server Database Project:</p>
  
  <pre><code>var propertyGroup = new BuildPropertyGroup();
  propertyGroup .SetProperty("Configuration", "Release");
  propertyGroup .SetProperty("TargetDatabase", &lt;databasename&gt;);
  propertyGroup .SetProperty("UseSandboxSettings", "false");
  propertyGroup .SetProperty("DeployToDatabase", "true");
  propertyGroup .SetProperty("TargetConnectionString", LocalHostConnectionString);
  new Engine().BuildProjectFile(&lt;DBProjFile&gt;, new[] { "Rebuild", "Deploy" }, propertyGroup);
  </code></pre>
  
  <p>This is being run in a setup fixture for a suite of unit tests. When run using Resharper the setup runs in a reasonable amount of time however if I Debug the tests I get loads of Trace noise in the Debug output. Most of the messages are logged at a verbose level.</p>
  
  <p>I have reflected over some of the assemblies involved and found that there is a TraceSource with the name "TSData" that is created in the static class Microsoft.Data.Schema.Common.Diagnostics.TSDTrace, Microsoft.Data.Schema.Utilities.</p>
  
  <p>I have tried applying the following to the app.config which has stopped any output appearing in the Debug window but the run time is unaffected:</p>
  
  <pre><code>&lt;system.diagnostics&gt;
      &lt;sources&gt;
          &lt;source name="TSData" switchName="foo" /&gt;
      &lt;/sources&gt;
      &lt;switches&gt;
          &lt;add name="foo" value="Off"/&gt;
      &lt;/switches&gt;
  &lt;/system.diagnostics&gt;
  </code></pre>
  
  <p>In the logging class there is this little gem:</p>
  
  <pre><code>if (TSDTrace.Settings._traceIfDebuggerAttached &amp;&amp; Debugger.IsAttached)
  {
      TSDTrace.Settings._traceToDebugOutput = true;
      TSDTrace.Settings._traceLevel = TraceLevel.Verbose;
  }
  </code></pre>
  
  <p>Where _traceIfDebuggerAttached is always true. I am hopping that I have missed something. Ultimately I would like to disable this from code but I would settle for a solution involving the app config.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I had made a mistake, the Trace Source is in-fact "TSData" which I have amended above. I have set the log level to Off in the app.config which has prevented the output from appearing in the Debug output but the speed is still the same. It appears this issue is more specific to what I am trying to do so I have added more detail to the original question.</p>