ErikEJ.DacFX.DacDeploySkip 1.0.10

Prefix Reserved
dotnet tool install --global ErikEJ.DacFX.DacDeploySkip --version 1.0.10
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local ErikEJ.DacFX.DacDeploySkip --version 1.0.10
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=ErikEJ.DacFX.DacDeploySkip&version=1.0.10
                    
nuke :add-package ErikEJ.DacFX.DacDeploySkip --version 1.0.10
                    

Dac Deploy Skip

Tool to determine if a deployment of a specific .dacpac file is required based on metadata present in the target database.

This can reduce your .dacpac deployment times significantly in scenarios you deploy the same .dacpac multiple times, e.g. in CI/CD pipelines.

Getting started

The tool runs on any system with .NET 10 or later installed.

Installing the tool

dotnet tool install -g ErikEJ.DacFX.DacDeploySkip

Basic usage

dacdeployskip check "<path to .dacpac>" "SQL Server connection string" 

This command will return 0 if the .dacpac has already been deployed, otherwise 1.

dacdeployskip mark "<path to .dacpac>" "SQL Server connection string"

This command will add metadata to the target database to register the .dacpac as deployed.

You can use the optional -namekey parameter to use the name of the .dacpac file instead of the full path as key.

dacdeployskip mark "<path to .dacpac>" "SQL Server connection string" -namekey

Use -profile with both check and mark to include the deployment options and SQLCMD variables from the DacFX publish profile in the checksum:

dacdeployskip check "<path to .dacpac>" "SQL Server connection string" -profile "<path to .publish.xml>"

Pass the same publish profile to SqlPackage so the checksum represents the active deployment options. Target database and connection string values are excluded from the checksum.

Simpler usage in GitHub Actions

If you use GitHub Actions, you can call the repository action directly instead of installing the tool yourself. Here is a complete minimal workflow:

name: Deploy dacpac

on:
  workflow_dispatch:

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v7

      - name: Check if dacpac deployment is needed
        id: dacdeployskip
        uses: ErikEJ/DacDeploySkip@v1
        with:
          command: check
          dacpac-path: ./Database/bin/Release/net10.0/Database.dacpac
          connection-string: ${{ secrets.SQL_CONNECTION_STRING }}

      - name: Install SqlPackage
        if: steps.dacdeployskip.outputs.deployed != 'true'
        run: dotnet tool install -g Microsoft.SqlPackage

      - name: Deploy dacpac
        if: steps.dacdeployskip.outputs.deployed != 'true'
        run: sqlpackage /Action:Publish /SourceFile:"./Database/bin/Release/net10.0/Database.dacpac" /TargetConnectionString:"${{ secrets.SQL_CONNECTION_STRING }}"

      - name: Mark dacpac as deployed
        if: steps.dacdeployskip.outputs.deployed != 'true'
        uses: ErikEJ/DacDeploySkip@v1
        with:
          command: mark
          dacpac-path: ./Database/bin/Release/net10.0/Database.dacpac
          connection-string: ${{ secrets.SQL_CONNECTION_STRING }}

You can optionally pass tool-version to pin the NuGet package version used by the action and publish-profile to include the deployment options in the checksum.

Sample usage in Azure DevOps pipeline

trigger:
- main

pool:
  name: selfhosted

variables:
  buildConfiguration: 'Release'
  connectionString: 'Data Source=(localdb)\mssqllocaldb;Initial Catalog=TestBed;Integrated Security=true;Encrypt=false'
  dacpacPath: '$(Build.SourcesDirectory)\Database\bin\Release\net10.0\Database.dacpac'

steps:

  - powershell: |
      dotnet tool install -g Microsoft.SqlPackage
      dotnet tool install -g ErikEJ.DacFX.DacDeploySkip
      dotnet build $(buildConfiguration)
      dacdeployskip check "$(dacpacPath)" "$(connectionString)"
      if (!$?)
      {
         sqlpackage /Action:Publish /SourceFile:"$(dacpacPath)" /TargetConnectionString:"$(connectionString)"
         dacdeployskip mark "$(dacpacPath)" "$(connectionString)"
      }
    displayName: deploy dacpac if needed only

You can find a complete example here.

You can also use the tool to set a condition in your pipeline based on whether a deployment is needed or not. This can be useful if you use a task like SqlAzureDacpacDeployment or SqlDacpacDeploymentOnMachineGroup.

- powershell: |

    dacdeployskip check "$(dacpacPath)" "$(ConnectionString)"
    if (!$?)
    {
      Write-Host "##vso[task.setvariable variable=DeployDacPac;]$true"  
    }
    else
    {
      Write-Host "##vso[task.setvariable variable=DeployDacPac;]$false"  
    }
  displayName: check if dacpac deployment is needed

Then use the condition on subsequent tasks:

 condition: and(succeeded(), eq(variables['DeployDacPac'], true))

Using multiple deployments against the same database

If you deploy multiple different .dacpac files against the same database, use the additional parameter /p:DropExtendedPropertiesNotInSource=False to avoid dropping the metadata added by this tool.

If you use a publish profile, you can add the same parameter there.

<DropExtendedPropertiesNotInSource>False</DropExtendedPropertiesNotInSource>
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.0.10 3,903 9/14/2026
1.0.9 145 9/11/2026
1.0.8 434 9/10/2026
1.0.7 2,697 10/17/2025
1.0.6 244 10/15/2025
1.0.5 257 10/15/2025
1.0.4 243 10/15/2025
1.0.3 249 10/14/2025
1.0.2 259 10/14/2025
1.0.1 254 10/14/2025
1.0.0 269 10/14/2025

Initial release