3

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.

2 Answers 2

4

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 `
Sign up to request clarification or add additional context in comments.

Comments

1

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?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.