Override properties of SQL publish profile with MSBuild

Mark Hellegers 46 Reputation points

I am trying to override the TargetDatabaseName property of my sql publish file, but I cannot get it to work.

I searched on the internet and I found two (old) Microsoft forum pages where someone gave an answer how it should work, but trying that same solution fails.

The two pages are the following:



Has anyone gotten this to work?

I have tried the following commands:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild" /t:publish /p:SqlPublishProfilePath=BuildFile.publish.xml /p:Publish_TargetDatabaseName="BuildDB"

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild" /t:publish /p:SqlPublishProfilePath=BuildFile.publish.xml /p:TargetDatabaseName="BuildDB"

But in both cases I get the error "Deploy error Deploy72002: Property TargetDatabase

must be specified"

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,317 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Greg Low 1,680 Reputation points Microsoft Regional Director

    Pretty sure the property is called TargetDatabase not TargetDatabaseName like you have in your commands. Have you tried the second option but with "TargetDatabase" in place of "TargetDatabaseName". Note that is the property in the error message.

    0 comments No comments