Programmatically get parameters required by DACPAC
-
03-10-2020 - |
Domanda
Is there a way to find out what parameters a DACPAC requires? I know they are listed in an error message if you try to publish without parameters, but that takes too long - 10-15 seconds. Also, a database needs to be targeted to get the error message with the list.
Soluzione
The DACPAC is just a zip file, so you could UnZip it and parse the model.xml file contained.
small extract from one of my dacpacs:
<DataSchemaModel FileFormatVersion="1.2" SchemaVersion="2.4" DspName="Microsoft.Data.Tools.Schema.Sql.Sql100DatabaseSchemaProvider" CollationLcid="1033" CollationCaseSensitive="False" xmlns="http://schemas.microsoft.com/sqlserver/dac/Serialization/2012/02">
<Header>
<CustomData Category="SqlCmdVariables" Type="SqlCmdVariable">
<Metadata Name="ABC" Value="" />
<Metadata Name="XYZ" Value="" />
</CustomData>
so I need to define the SqlCmdVariables ABC and XYZ for this dacpac
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a dba.stackexchange