I am deploying a dacpac using sqlpackage.exe and need to pass SqlCMD variables for a postdeployment script in the dacpac. I found a related question here and here.
But i am getting the following error: Missing values for the following SqlCmd variables:BuildVersion Description. Description=$Description : The term 'Description=$Description' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Please help me.
The correct switch for passing a SQLCMD variable to SQLPackage is like this /v:Description=$Description
Powershell quoting is a bit tricky. Here's an example for you:
https://gist.github.com/davoscollective/adf9b890984e51d8dee2
& "C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\sqlpackage.exe" ` #Note this is SQL Server 2012 specific directory, alter as needed
/Action:Publish `
/SourceFile:$sourceFile `
/TargetServerName:$targetServerName `
/TargetDatabaseName:$targetDBname `
/V:SQLCMDVariable1=$SQLCMDVariable1 ` #If your project includes other database references, or pre/post deployment scripts uses SQLCMD variables
/v:SQLCMDVariable2=$SQLCMDVariable2 `
It seems like you are using Powershell to call SqlPackage based on the cmdlet error. If this is the case ensure the Dollar symbols are escaped with a inverted apostrophe i.e.
ie Description=`$Description
Could you post the full command you are passing?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With