Reputation: 13733
I have a mixed solution with a couple of Web applications and SQL Database projects.
I also have a remote test server with MS SQL 2012 and IIS 7. The TFS build server is on another machine. All the servers are configured on a single domain.
I would like to deploy the databases and the web applications during the build process.
Now I have set up build package generation in a TFS XAML process file using the following flags:
/p:DeployOnBuild=True
and I have also set up other flags for web publishing:
/p:DeployTarget=MsDeployPublish
/p:CreatePackageOnPublish=True
/p:MsDeployPublishMethod=WMSVC
/p:AllowUntrustedCertificate=True
but I am a bit confused which method should I use: WMSVC or Remote Agent or something else. Which is the easiest way to set up the Web deployiment from TFS build server to IIS 7 server and avoid problems with user accounts (to avoid setting /p:UserName=YOURUSERNAME /p:Password=YOURPASSWORD in XAML or build definition) ?
The other concern is about Database projects. The build process has generated some .dacpac files. What would be the best way to deploy them from the TFS build process XAML?
As my solution has mixed types of projects, I am not sure how to adjust my build process so it correctly detects which projects need database deploy and which need Web deploy.
I hope MSBuild/MSDeploy is smart enough to just ignore those /p: flags if the currrent project is not a web app or maybe it will genereate a failure for entire build process?
Upvotes: 3
Views: 5360
Reputation: 13733
These two websites:
Headless msbuild support for ssdt sqlproj projects
helped me a lot to set up everything correctly.
And now I know that WMSVC is preferred (over RemoteAgent) method for remote publishing on IIS7, but I need to install WebDeploy on the target server. On localhost InProc works just fine.
One major issue was that I was pulling my hair out trying to publish Web apps after building all the solutions, but MSBuild just kept saying "Skipping unpublishable applications".
And the problem was
Targets="Publish"
in my MSBuild script. When I changed it to
Targets="Build"
and put properties for my project:
Configuration=Release;
SkipInvalidConfigurations=true;
DeployOnBuild=true;
CreatePackageOnPublish=true;
AllowUntrustedCertificate=true;
DeployTarget=MsDeployPublish;
MSDeployPublishMethod=InProc;
MsDeployServiceUrl=localhost;
DeployIISAppPath=Default Web Site\MyWebApp
it finally started actually publishing to the IIS7 on my localhost.
Uhh, why the Publish target does not publish, but only Build target does? That's a mystery for me. Especially because I use Publish target for my sqlproj projects and they get actually published to the SQL server just fine.
Upvotes: 3