Deploying Database and Web Projects during TFS Build Process

I have a mixed solution with multiple web applications and SQL database projects.

I also have a remote test server running MS SQL 2012 and IIS 7. The TFS build server is on a different machine. All servers are configured in the same domain.

I would like to deploy databases and web applications during the build process.

I have now configured the build package creation in the TFS XAML process file using the following flags:

/p:DeployOnBuild=True

      

and I also set other flags for web publishing:

/p:DeployTarget=MsDeployPublish
/p:CreatePackageOnPublish=True
/p:MsDeployPublishMethod=WMSVC
/p:AllowUntrustedCertificate=True

      

but i'm a little confused which method should i use: WMSVC or Remote Agent or whatever. Easiest way to set up web deployment from TFS build server to IIS 7 server and avoid user account issues (avoid setting / p: UserName = YOURUSERNAME / p: Password = YOURPASSWORD in XAML or build definition)?

Another problem concerns database projects. The build process called some .dacpac files. What would be the best way to deploy them from the TFS XAML build process?

As my solution has mixed project types, I'm not sure how to fine-tune the build process so that it correctly identifies which projects require database deployment and what Web deployment is required for.

I hope MSBuild / MSDeploy is smart enough to just ignore those / p: flags if the live project is not a web application, or maybe it will generate an error for the entire build process?

+3


source to share


1 answer


These two sites:

Incorrect deployment

Headless msbuild support for ssdt sqlproj projects

it helped me a lot to set everything up correctly.

And now I know that WMSVC is preferred (over RemoteAgent) for remote publishing to IIS7, but I need to install WebDeploy on the target server. On localhost, InProc works fine.

One of the main issues was that I was pulling my hair out trying to publish web apps after all solutions were built, but MSBuild just kept saying "Skipping non-public apps".

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

      

finally started actual publishing to IIS7 on my localhost.

Uhh why is the post target not published but only the assembly object works? This is a mystery to me. Especially since I am using the Publish target for my sqlproj projects and they do publish to SQL Server just fine.

+3


source







All Articles