Powershell slow compared to MSBuild

After upgrading to SCA 4, my old msbuild scripts started acting strange, and I noticed there isn't a section in the documentation for MSBuild anymore. I've got everything working with the power shell scripts, but it about 10 times slower to do a deployment compared to msbuild deploy on build. Is there something i'm missing? It seems like maybe it's doing more validation and drift comparisons or something. Am I correct that msbuild is no longer supported?
Tagged:

Answers

  • Sergio RSergio R Posts: 610 Rose Gold 5
    edited June 12, 2020 12:07PM
    MSBuild is a legacy deployment method, we recommend using the Powershell cmdlets.
    You should be able to speed up your process by replacing Invoke-DatabaseBuild with the New-DatabaseProjectObject cmdlet: using this cmdlet skips schema validation during the build (it also disables Drift verification when deploying).

    For example:

    $dbBuildArtifact = $ProjectFile | New-DatabaseProjectObject | New-DatabaseBuildArtifact -PackageId MyDatabase -PackageVersion 1.0.0

    #Create the deployment artifact targeting the database to be updated
    $target = New-DatabaseConnection -ServerInstance "${SqlServerMachineName\${SqlServerInstanceName}" -Database ${DBName}
    $releaseArtifact = New-DatabaseReleaseArtifact -Source $dbBuildArtifact -Target $target

    # Deploy to the database
    Use-DatabaseReleaseArtifact $releaseArtifact -DeployTo $target -DisableMonitorAnnotation -SkipPreUpdateSchemaCheck -SkipPostUpdateSchemaCheck
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
  • Fugazzi8Fugazzi8 Posts: 5 New member
    I'm already doing this, it's just so slow to generate the release artifact. Also, it outputs the following even though I'm using just the project object sourced build artifact without verifying it:

    DEBUG: Performing drift analysis
    DEBUG: DriftSyncFile: C:\Users\mcooper.SNAPWORX\AppData\Local\Temp\2\DLM Automation\gq0anlaz.0g4\artifacts\SNAPReadyRoll_snapmaster_DriftSyncScript.sql
    DEBUG: DriftReportFile: C:\Users\mcooper.SNAPWORX\AppData\Local\Temp\2\DLM Automation\gq0anlaz.0g4\artifacts\SNAPReadyRoll_snapmaster_DriftReport.html
    Starting Drift Analysis...  (because SkipDriftAnalysis=False)



  • Sergio RSergio R Posts: 610 Rose Gold 5
    There was an issue that caused the "Starting Drift Analysis" message to display incorrectly, this has now been fixed in the latest version.
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
Sign In or Register to comment.