Sql-server – SqlPackage does not pick up variables from profile

sql server

I want to upgrade a database using .dacpac and sqlpackage.exe

here is how I run sqlpackage:

SqlPackage.exe
    /Action:Publish
    /SourceFile:"my.dacpac"
    /Profile:"myprofile.publish.xml"

The error I get is:

* The following SqlCmd variables are not defined in the target scripts: foo.

I have verified that myprofile.publish.xml file does contain that var:

<ItemGroup>
  <SqlCmdVariable Include="foo">
    <Value>bc\local</Value>
  </SqlCmdVariable>

I also verified that project that creates dacpac does publish successfully from within visual studio using myprofile.publish.xml

What else could I be missing?

(I'm using SQL Server 2012)

Best Answer

Look at the references in your database solution. You will probably see them there. You can use the SQLPackage Script action to see the variables actually included in your dacpac.