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
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`""
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With