Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy database project (.dbproj) using powershell

I want to deploy a database project "database.dbproj" (for example) using powershell. So far, I tried to deploy project using following methods,

$msbuild = 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe'

$option1 = @(' /t:reBuild,deploy /p:TargetConnectionString="Data Source=(local)\SQL2008R2;Integrated Security=True;Pooling=False;" /p:TargetDatabase=test "C:\TEMP\SVN\6000\Database\Database.dbproj"')

& $msbuild $option1

And

$test1 = @(' /target:Build,deploy','C:\TEMP\SVN\6000\Database\Database.dbproj','/property:TargetConnectionString="Data Source=(local)\SQL2008R2;Integrated Security=True;Pooling=False;"','/property:TargetDatabase=test')

& $msbuild $test1

and

$test2 = $msbuild +"" + $option1

Invoke-Expression $test2

But in all cases it doesn't do anything. I mean if I debug the code then I can see that this pointer reaches to this command and then simply moves to next line of command without doing anything. I have similar Batch script, and it works just fine. So I am sure that it is some noob mistake that is causing this issue. What is wrong I am doing here ?

Thanks, Jack

like image 877
JackLock Avatar asked Feb 11 '13 15:02

JackLock


1 Answers

Try the following:

Start-Process -FilePath "C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" -ArgumentList "/t:reBuild,deploy /p:TargetConnectionString=`"Data Source=(local)\SQL2008R2;Integrated Security=True;Pooling=False;`" /p:TargetDatabase=test `"C:\TEMP\SVN\6000\Database\Database.dbproj`""
like image 56
Musaab Al-Okaidi Avatar answered Nov 15 '22 09:11

Musaab Al-Okaidi