Database Administrators Asked by THX-1138 on December 24, 2021
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>bclocal</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)
You might have wrong dacpac. For example, you might extracted the dacpac from the database and this dacpac doesn't have any information about variables already. You can rename dacpac as *.zip
and make sure that model.xml
has your variables.
Answered by Dmitrij Kultasev on December 24, 2021
$(foo)
defined in that variable listI 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)
Answered by luviktor on December 24, 2021
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.
Answered by Eric on December 24, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP