Search code examples
c#sql-serverdacpac

C# DacFx package and querying out list of SQLCMD Variables from DACPAC


Is it possible using the Microsoft.SqlServer.DacFx.x64 nuget package to query out the list of SQLCMD Variables from a dacpac file?


Solution

  • Since there is not much activity here: don't know if DacFx can do this, however DACPAC file is a ZIP archive containing model.xml which is the whole body of SSDT project. Unzipping and extracting values can be automated.

    SqlCmdVariables in this XML file look like shown below: enter image description here

    XPath would be //Header/CustomData[@Category='SqlCmdVariables']/Metadata/@Name