Access SQLCMD Variables in the Pre/Post build event command line?


i have sqlcmd variable defined in project , reference variable in pre-build event.

for example:

if i use build event command line of

call $(projectdir)createcommand.bat $(projectdir) 022 predeployment

where 022 represents custom software version number command works expected.

however, if try reference the sqlcmd variable of $(majorversion)  which has default set 022 in

call $(projectdir)createcommand.bat $(projectdir) $(majorversion) predeployment

it doesn't work. can see upon build $(majorversion) being evaluated empty string.

any ideas?


why push envelope when can open it?

hi jason,

you can't use sqlcmd variables in pre build events. sqlcmd variables intended used @ deployment time string macro gets executed. if you're using msbuild in conjunction ssdt you'd able around having task execute before dacpac gets built. 



SQL Server  >  SQL Server Data Tools



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........