开发者

How do you deploy a website and database project using TFS 2010?

开发者 https://www.devze.com 2022-12-31 06:44 出处:网络
I\'ve been trying to figure this out and so far haven\'t found a simple solution. Is it really that hard to deploy a database project (and a web site) using TFS 2010 as part of the build process?

I've been trying to figure this out and so far haven't found a simple solution. Is it really that hard to deploy a database project (and a web site) using TFS 2010 as part of the build process?

I've found one example that involved lots of complicated checks and editing the workflow (which is a giant workflow btw).

I've even purchased the book "professional application lifecycle management with VS 2010", but apparently professionals don't deploy their a开发者_JAVA百科pplications since it isn't even mentioned in the book.

I know I'm retarded when it comes to TFS, but it seems like there should be any easy way to do this. Is there?


I can't speak for the database portion, but I just went through this on the web portion, the magic part is not very well documented component, namely the MSBuild Parameters.

In your build definition:

  1. Process on the Left
  2. Required > Items to Build > Configurations to Build
    • Edit, add a new one, for this example
      • Configuration: Dev (I cover how to create a configuration below)
      • Platform: Any CPU
  3. Advanced > MSBuild Process
    • Use the following arguments (at least for me, your publish method may vary).

MsBuild Params:

/p:MSDeployServiceURL="http://myserver"  
/p:MSDeployPublishMethod=RemoteAgent 
/p:DeployOnBuild=True 
/p:DeployTarget=MsDeployPublish 
/p:CreatePackageOnPublish=True 
/p:username=aduser
/p:password=adpassword

Requirements:

  1. You need to install the MS Deploy Remote Agent Service on the destination web server, MSDeploy needs to be on the Build/Deployer server as well, but this should be the case by default.
  2. The account you use in the params above needs admin access, at least to IIS...I'm not sure what the minimum permission requirements are.

You configure which WebSite/Virtual Directory the site goes to in the Web project you're deploying. Personally I have a build configuration for each environment, this makes the builds very easy to handle and organize. For example we have Release, Debug and Dev (there are more but for this example that's it). Only the Web project has a Dev configuration.

To do this, right click the solution, Configuration Manager..., On the web project click the configuration drop down, click New.... Give it a name, "Dev" for this example, copy settings from debug or release, whatever matches closest to what your deployment server environment should be. Make sure "Create new solution configurations" is checked, it is by default. After creating this, change the configuration dropdown on the solution to the new Dev one, and Any CPU...make sure your projects are all correct, I had some flipping to x86 and x64 randomly, not sure of the exact cause of that).

In your web project, right click, properties. On the left, click Package/Publish Web (you'll also want to mess with the other Package/Publish SQL tab, but I can't speak to that). In the options on the right click Create deployment package as a zip file. The default location is fine, the next textbox I didn't find documented anywhere. The format is this: WebSite/Virtual Directory, so if you have a site called "BuildSite" in IIS with no virtual directory (app == site root), you would have BuildSite only in this box. If it was in a virtual directory, you might have Default Web Site/BuildVirtualDirectory.

After you set all that, make sure to check-in the solution and web project so the build server has the configuration changes you made, then kick off a build :)

If you have more questions, I recommend you watch this video by Vishal Joshi, specifically around 22 and 59 minutes in, he covers the database portion as well...but I have no actual experience trying it since we're on top of a non MSSQL database.

0

精彩评论

暂无评论...
验证码 换一张
取 消