patternsqlMinor
SqlPackage does not pick up variables from profile
Viewed 0 times
fromprofiledoessqlpackagevariablespicknot
Problem
I want to upgrade a database using .dacpac and sqlpackage.exe
here is how I run sqlpackage:
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:
I also verified that project that creates dacpac does publish successfully from within visual studio using
What else could I be missing?
(I'm using SQL Server 2012)
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:
bc\local
I also verified that project that creates dacpac does publish successfully from within visual studio using
myprofile.publish.xmlWhat else could I be missing?
(I'm using SQL Server 2012)
Solution
- Open Visual Studio
- Right click on your Database project
- Open SQLCMD Variables page on the left side
- Check if you have
$(foo)defined in that variable list
I had the same issue the "missing" variables were defined in the publish.xml but I still received the same message. Then I browsed the .sqlproj file and I saw that not all the variables are listed there.
(I used Visual Studio 2019)
Context
StackExchange Database Administrators Q#45938, answer score: 2
Revisions (0)
No revisions yet.