Deploy a database project (.dbproj) with powershell

I want to deploy the database project "database.dbproj" (for example) using powershell. So far, I have been trying to deploy a project using the 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 ; Accumulation = False; "", '/ property: TargetDatabase = test')

& $ msbuild $ test1

and

$ test2 = $ msbuild + "" + $ option1

Invoke-Expression $ test2

But in all cases, it does nothing. I mean, if I debug the code, then I see that this pointer reaches this command, and then just moves on to the next line of the command, doing nothing. I have a similar script package and it works fine. Therefore, I am sure that this is some error related to the error that causes this problem. What is wrong, what am I doing here?

Thanks Jack

+5
1

:

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`""
+5

All Articles