How do i script the deployment of the Visual Studio database project?

I've got a DB project in visual studio and I must utilize it to be able to deploy on remote machines using a script. I observe that after i 'deploy' from visual studio, it creates b .sql file.

I intercepted this file and attempted running it in the command line with osql.exe, however i did not have success. If this should work, it is possible to better method to deploy a database programatically from the database project, might be by referencing in another project and calling some approach to deploy it?

MSBuild /target:SQLBuild MyProjectName.dbproj

Works a build-only action. It develops merely a single database project named MyProjectName.dbproj. The project qualities inside the .dbproj file are utilized to assemble the build script.

MSBuild /target:Deploy /property:TargetDatabase=UpdatedTargetDatabase;TargetConnectionString="Data Source=(local)\SQLEXPRESS;Integrated Security=True;Pooling=False" MyProjectName.dbproj

Deploys the database project, overriding the prospective database title and connection string.