microsoft / microsoft/DacFx

sqlpackage runs sp_refreshsqlmodule before rebinding full-text indexes, causing failures on modules using CONTAINS/FREETEXT

Open
#758 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug regression
Dominant language
C#
Stars
460
Forks
29
Avg merge
4d 9h
Merged PRs (30d)
7

Description

- SqlPackage or DacFx Version: 162.5.57 (latest as of Feb 2026, via MSBuild.Sdk.SqlProj 4.0.0)
- .NET Framework (Windows-only) or .NET Core: .Net 8
- Environment (local platform and source/target platforms): Windows 11 / SQL Server 2019 (Sql150) and Azure SQL, Linux

**Steps to Reproduce:**

1. Create a database with a table that has a full-text index (e.g., fac.Facility with a full-text catalog on nvarchar columns)
2. Create a stored procedure or view that uses CONTAINS() or FREETEXT() on that table
3. In the dacpac, change a column length on the full-text-indexed table (e.g., nvarchar(100) → nvarchar(200))
4. Deploy with sqlpackage /Action:Publish (or dotnet publish via MSBuild.Sdk.SqlProj)
5. DacFx generates a deployment script with this ordering:
• Unbinds full-text index
• Applies DDL (ALTER TABLE)
• Runs sp_refreshsqlmodule on dependent modules ← fails here ❌
• Rebinds full-text index
6. Any module using CONTAINS()/FREETEXT() fails during refresh because the full-text index doesn't exist yet

** Expected result **

SSDT's built-in publish (right-click .sqlproj → Publish in Visual Studio 2022 17.14) uses the correct ordering on the same database and dacpac:
1. Unbinds full-text index
2. Applies DDL (ALTER TABLE)
3. Rebinds full-text index ✅
4. Runs sp_refreshsqlmodule on dependent modules

**sqlpackage** should match SSDT's ordering — full-text indexes should be rebound **before** module refresh.

**Did this occur in prior versions? If not - which version(s) did it work in?**

SSDT in Visual Studio 2022 (17.14) does NOT exhibit this issue — it correctly rebinds FT indexes before refreshing modules. The issue is specific to sqlpackage CLI and the DacFx NuGet package (as consumed by MSBuild.Sdk.SqlProj). We have not tested older sqlpackage versions to determine when the ordering divergence was introduced.

(DacFx/SqlPackage/SSMS/Azure Data Studio)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the deployment with SqlPackage /Action:Publish using a full-text-indexed table and a module containing CONTAINS or FREETEXT, then inspect the generated deployment script. Compare it with the SSDT publish ordering; done means the script rebinds full-text indexes before running sp_refreshsqlmodule on dependent modules.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
database, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.