共用方式為


SQL Server Data Tools (SSDT) 所使用的 Alter DacFx

在特定情況下,您可能需要在 Visual Studio 中使用不同版本的 DacFx 與 SQL Server Data Tools 介面。 可能的話,如果需要來自 SQL Server Data Tools 的替代版本,建議使用獨立版本的 DacFx。

請遵循下列程序來改變 SQL Server Data Tools (SSDT) 所使用的 DacFx 版本。

取代 SSDT 中的 DacFx 檔案

SQL Server Data Tools 會將 DacFx 檔案儲存在 Visual Studio 程式檔內的 Common7\IDE\Extensions\Microsoft\SQLDB\DAC 下方。 針對 Visual Studio 2022 Community,完整路徑通常是 C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Microsoft\SQLDB\DAC

替代應該在相同的 DacFx 主要版本內完成。 例如,如果 Visual Studio 17.9 (2022) 使用 DacFx 162.2.33.1 版,則應該只使用其他 162.x 版本。 若要檢視目前的版本,請在檔案總管中從 SSDT DacFx 資料夾選取 Microsoft.SqlServer.Dac.dll 檔案,然後使用操作功能表開啟檔案屬性。

DacFx 會發佈至 NuGet。 識別 Microsoft.SqlServer.DacFx NuGet 摘要內所需的版本,並遵循下列步驟以搭配使用 SSDT:

  1. 從 Web 介面針對 DacFx 版本下載 NuGet 套件。

  2. nupkg 檔案變更為 zip 檔案,並解壓縮該封存。

  3. 關閉 Visual Studio。

  4. 將下列檔案從 lib/net462 複製到 SSDT DacFx 資料夾:

    • Microsoft.Data.Tools.Schema.Sql.dll
    • Microsoft.Data.Tools.Utilities.dll
    • Microsoft.SqlServer.Dac.dll
    • Microsoft.SqlServer.Dac.Extensions.dll
    • Microsoft.SqlServer.Dac.Extensions.xml
    • Micrososft.SqlServer.Dac.xml
    • Microsoft.SqlServer.TransactSql.ScriptDom.dll
    • Microsoft.SqlServer.Types.dll

在此程序之後,SQL 專案需要清除或重建,才能正確併入已取代的 DacFx 版本。