visual studio – Deployment pipeline for SQL Server 2022 DACPAC file throws an error Microsoft.Data.Tools.Schema.Sql.Sql160DatabaseSchemaProvider is not valid


This error typically means that the required SQL Server platform schema provider — specifically the one for SQL Server 2022 (Sql160DatabaseSchemaProvider) — is missing on the machine where the DACPAC deployment is being executed. In your case, even though the build pipeline is working fine and the DACPAC file is being generated successfully, the deployment fails because the target machine (likely your on-premises SQL Server or a jumpbox) doesn’t have the necessary components installed.

The key issue is that the actual deployment step is being run on the target machine (via WinRM), and not on your Azure DevOps agent. For this reason, the target machine itself needs to have the latest version of the SQL Server Data-Tier Application Framework (DACFx) that supports SQL Server 2022 (also referred to as DACFx v160). Without this, the deployment process doesn’t recognize the schema provider required by your DACPAC file, resulting in the internal error you’re seeing.

To fix this, you need to install DACFx v160 on the machine where the DACPAC is being deployed. You can download the latest DACFx installer from Microsoft’s official site here. Choose the .msi version and install it on the target server. This will include support for SQL Server 2022 deployments. Once installed, you can verify the installation using PowerShell by running Get-Command "SqlPackage.exe" and checking that it’s pointing to the correct version and path (ideally something like C:\Program Files\Microsoft SQL Server\160\DAC\bin\SqlPackage.exe).

If the built-in Azure DevOps task (SqlDacpacDeploy@2) continues to give you issues, a reliable alternative is to bypass it and run the deployment directly using SqlPackage.exe within a PowerShell task. This gives you full control over the deployment process and ensures you’re using the correct DACFx version. A simple inline PowerShell script within your pipeline can handle this, where you specify the path to your DACPAC file, your target server and database name, and your SQL authentication credentials.

Lastly, make sure that your Visual Studio database project is targeting SQL Server 2022 (v160) and that all connectivity and permissions (especially for WinRM if you’re still using the extension) are correctly configured on the deployment server.

Leave a Reply

Your email address will not be published. Required fields are marked *