0

How to edit the SchemaCompare Settings in the SchemaComparison object?

$SchemaComparison = [SchemaComparison]::new( $SourceEndPoint, $TargetEndPoint ) $SchemaComparison.Options = $DeployOptions

I am particularly looking to Remove Database options, but the SchemaCompare settings do not appear to be accessible by code:

$SchemaComparison.Options.ExcludeDatabaseOptions #(not known property of the Options object)

$SchemaComparison.SettingsService #(not a known property)

How can I do in code what I can EASILY do from the SSDT compare UI?

enter image description here

user5855178
  • 567
  • 1
  • 7
  • 17

1 Answers1

0

I found the answer. There is an excludedObjects property hiding in the options object. It's an array of ObjectType enums:

$SchemaComparison.Options.ExcludeObjectTypes += [ObjectType]::Aggregates
$SchemaComparison.Options.ExcludeObjectTypes += [ObjectType]::ApplicationRoles
$SchemaComparison.Options.ExcludeObjectTypes += [ObjectType]::Assemblies

You can exclude any you want. The MSDN includes the list here:

https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dac.objecttype.aspx

user5855178
  • 567
  • 1
  • 7
  • 17