0

How to show detailed diagnostic information when publishing dacpac with dacservices object?

SqlPackage.exe has a Diagnostics switch for detailed output of the publish operation.

/Diagnostics:   /d  {True|False}    Specifies whether diagnostic logging is output to the console. Defaults to False.

My question is how do I enable this for dacservices instead of using the exe?

The deploy and publish methods below do not seem to offer a parameter for this:

public Microsoft.SqlServer.Dac.PublishResult Publish (Microsoft.SqlServer.Dac.DacPackage package, string targetDatabaseName, Microsoft.SqlServer.Dac.PublishOptions publishOptions);

public void Deploy (Microsoft.SqlServer.Dac.DacPackage package, string targetDatabaseName, bool upgradeExisting = false, Microsoft.SqlServer.Dac.DacDeployOptions options = default, System.Threading.CancellationToken? cancellationToken = default);

This question would further apply for using Sql Server Data tools inside visual studio as a publish profile.. there seems to be no means to enable detailed diagnostic information to be output during a db publish operation.

user5855178
  • 567
  • 1
  • 7
  • 17
  • I'm not familiar with DacServices, but looking at the `DacServices` class, it shows there is a `DiagnosticTrace` property. And `SqlPackage.exe` seems to use `Microsoft.Data.Tools.Diagnostics.Tracer`. So you might be able to figure out the necessary connections there to make that work. – Chad Baldwin Aug 26 '22 at 19:08
  • Also, as far as using the Visual Studio publish option, it also looks like you can specify the diagnostic flags that SqlPackage uses inside of a DAC publish profile XML file. – Chad Baldwin Aug 26 '22 at 19:10

0 Answers0