团队建设:使用MSDeploy在本地发布 [英] Team Build: Publish locally using MSDeploy

查看:107
本文介绍了团队建设:使用MSDeploy在本地发布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我才刚刚开始使用团队构建功能,并且发现要做一些非常简单的事情所需的大量工作有点让人不知所措.目前,我的设置是一个包含Web应用程序,装配应用程序和测试应用程序的解决方案.该Web应用程序具有一个PublishProfile设置,可以通过文件系统发布.

I'm just getting started with the team build functionality and I'm finding the sheer amount of things required to do something pretty simple a bit overwhelming. My setup at the moment is a solution with a web app, an assembly app and a test app. The web app has a PublishProfile set up which publishes via the filesystem.

我设置了一个TFS构建定义,该定义当前每晚构建整个解决方案,并将其作为旧构建的备份放到网络共享上.我现在想要做的就是让我已经设置的PublishProfile为我发布Web应用程序.我敢肯定这真的很简单,但是我整整一天都在玩MSBuild命令,但是没有运气.救命!

I have a TFS build definition set up which currently builds the entire solution nightly and drops it onto a network share as a backup of old builds. All I want to do now is have the PublishProfile I've already setup publish the web app for me. I'm sure this is really simple but I've been playing with MSBuild commands for a full day now with no luck. Help!

推荐答案

不幸的是,MSBuild中不支持或未实现发布配置文件的共享.从概要文件发布的逻辑包含在VS本身中.幸运的是,配置文件中包含的信息不多,因此可以通过多种方法来实现所需的功能.我们的目标并不特别支持与发布对话框完全相同的步骤,但是要从团队建设中获得相同的结果,您有两种选择,我将在此处进行概述.

Unfortunately sharing of the Publish Profile is not supported or implemented in MSBuild. The logic to publish from the profile is contained in VS itself. Fortunately the profile doesn't contain much information so there are ways to achieve what you are looking for. Our targets do not specifically support the exact same steps as followed by the publish dialog, but to achieve the same result from team build you have two choices, I will outline both here.

在设置团队构建定义以进行部署时,需要为构建过程传递一些MSBuild参数值.请参见下面我突出显示的图片.

When you setup your Team Build definition in order to deploy you need to pass in some values for the MSBuild Arguments for the build process. See image below where I have highlighted this.

选项1: 传递以下参数:

/p:DeployOnBuild=true;DeployTarget=PipelinePreDeployCopyAllFilesToOneFolder;PackageTempRootDir="\\sayedha-w500\BuildDrops\Publish";AutoParameterizationWebConfigConnectionStrings=false

让我稍微解释一下这些参数,向您显示结果,然后解释下一个选项. DeployOnBuild=true:这告诉项目执行在DeployTarget属性中定义的目标.

Let me explain these parameters a bit, show you the result then explain the next option. DeployOnBuild=true:This tells the project to execute the target(s) defined in the DeployTarget property.

DeployTarget=PipelinePreDeployCopyAllFilesToOneFolder:这指定DeployTarget目标.

DeployTarget=PipelinePreDeployCopyAllFilesToOneFolder: This specifies the DeployTarget target.

PackageTempRootDir="\\sayedha-w500\BuildDrops\Publish":这指定将写入软件包文件的位置.这是在打包文件之前写入文件的位置.

PackageTempRootDir="\\sayedha-w500\BuildDrops\Publish": This specifies the location where the package files will be written. This is the location where the files are written before they are packaged.

AutoParameterizationWebConfigConnectionStrings=false:这告诉Web发布管道(WPP)在web.config文件中不对连接字符串进行参数化.如果未指定,则连接字符串值将替换为占位符,例如$(ReplacableToken_dummyConStr-Web.config连接字符串_0)

AutoParameterizationWebConfigConnectionStrings=false: This tells the Web Publishing Pipeline (WPP) to not parameterize the connection strings in the web.config file. If you do not specify this then your connection string values will be replaced with placeholders like $(ReplacableToken_dummyConStr-Web.config Connection String_0)

执行完此操作后,您可以开始构建,然后在PackageTempRootDir位置内找到PackageTmp文件夹,其中包含您要查找的内容.

After you do this you can kick off a build then inside of the PackageTempRootDir location you will find a PackageTmp folder and this contains the content that you are looking for.

选项2: 因此,对于前一个选项,您可能会注意到它创建了一个名为PackageTmp的文件夹,如果您不希望这样做,则可以使用以下选项.

Option 2: So for the previous option you probably noticed that it creates a folder named PackageTmp and if you do not want that then you can use the following options instead.

/p:DeployOnBuild=true;DeployTarget=PipelinePreDeployCopyAllFilesToOneFolder;_PackageTempDir="\\sayedha-w500\BuildDrops\Publish";AutoParameterizationWebConfigConnectionStrings=false

此处的区别是您将传递_PackageTempDir而不是PackageTempRootDir.我之所以不建议这样做的原因是因为以_开头的MSBuild属性表示该属性实质上是内部的",即在将来的版本中它可能意味着其他含义或根本不存在.因此,使用后果自负.

The difference here is that instead of PackageTempRootDir you would pass in _PackageTempDir. The reason why I don't suggest that to begin with is because MSBuild properties that start with _ signify that the property in essentially "internal" in the sense that in a future version it may mean something else or not exist at all. So use at your own risk.

选项3

说了这么多,您可以只使用该版本来打包您的Web.如果要执行此操作,请使用以下参数.

With all that said, you could just use the build to package your web. If you want to do this then use the following arguments.

/p:DeployOnBuild=true;DeployTarget=Package

在生成的放置文件夹中执行此操作时,将像通常一样找到_PublishedWebsites文件夹,然后在其中存在一个文件夹{ProjectName} _Package,其中{ProjectName}是项目的名称.该文件夹将包含软件包,.cmd文件,参数文件以及其他几个文件.您可以使用这些文件来部署您的网站.

When you do this in the drop folder for your build you will find the _PublishedWebsites folder as you normally would, then inside of that there will be a folder {ProjectName}_Package where {ProjectName} is the name of the project. This folder will contain the package, the .cmd file, the parameters file and a couple others. You can use these files to deploy your web.

我希望这不是信息超载.

I hope that wasn't information over load.

这篇关于团队建设:使用MSDeploy在本地发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆