配置 TeamCity MSBuild 和 MSDeploy

发布于 2024-10-31 19:46:19 字数 811 浏览 4 评论 0原文

我在使用 MSBuild 和 MSDeploy 设置不同环境时遇到问题。

我在 TeamCity TestConfiguration 上设置了 2 个配置

  1. (这会在测试配置中构建应用程序并运行单元测试)
  2. StagingConfiguration (旨在打包并部署到我们的暂存盒以进行 UA 测试)

我的 TestConfiguration 工作正常,但 StagingConfiguration 不会部署包裹。

<MSBuild Projects="MyProject\MyProject.csproj"
         Properties="Configuration=Staging;
         DeployOnBuild=true;
         DeployTarget=Package;"/>

我已经尝试添加两者

_PackageTempDir=\\server\c$\WebDirectory;
PackageLocation=\\server\c$\WebDirectory;

,但似乎都没有做任何事情,我是否错过了重点?我还没有真正找到任何文档,只是到处都有奇怪的博客文章。我是否需要在 TeamCity 服务器上安装某些内容才能使 MSDeploy 正常工作?

我的理想场景是:

  1. 手动签入 tfs
  2. 在 TeamCity 中运行 StagingConfiguartion
  3. 构建代码并将其部署到 \server\c$\WebDirectory

I'm having issues setting up different envirnoments with MSBuild and MSDeploy.

I've setup 2 configurations on TeamCity

  1. TestConfiguration (This builds the app in Test Config and runs unit tests)
  2. StagingConfiguration (Is meant to package and deploy to our staging box for UA testing)

My TestConfiguration works fine but the StagingConfiguration doesn't deploy the package.

<MSBuild Projects="MyProject\MyProject.csproj"
         Properties="Configuration=Staging;
         DeployOnBuild=true;
         DeployTarget=Package;"/>

I've tried adding both

_PackageTempDir=\\server\c$\WebDirectory;
PackageLocation=\\server\c$\WebDirectory;

But neither seem to do anything, am i missing the point? I've not really been able to find any documentation, just the odd blog post here and there. Do I need to install something on my TeamCity server for MSDeploy to work?

My ideal scenario is:

  1. Check in to tfs
  2. Run StagingConfiguartion in TeamCity manually
  3. Code is built and deployed to \server\c$\WebDirectory

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

慕烟庭风 2024-11-07 19:46:19

您需要配置 TeamCity“系统属性”,该属性将传递给 MsBuild 并控制 MsDeploy 管道。

正确设置有点棘手,但需要设置的是:

  • system.CreatePackageOnPublish=true
  • system.DeployOnBuild=true
  • system.DeployTarget=MSDeployPublish
  • system.MSDeployPublishMethod=WMSvc
  • system.DeployIISAppPath=[Default Web Site]
  • system.MSDeployServiceUrl= [yourServerDomainName]
  • system.Username=[用户名]
  • system.Password=[密码]

我在这里写了一篇博客文章,其中包含更多详细信息:来自 TeamCity 的 Web 部署 (MS Deploy) - http://www.geekytidbits.com/web-deploy-ms-deploy-from-teamcity/

这是我的配置:
Teamcity 中系统属性示例的屏幕截图

You need to configure TeamCity "System Properties" that will be passed to MsBuild and control the MsDeploy pipeline.

It's a little tricky to get setup correctly but the ones you need to set are:

  • system.CreatePackageOnPublish=true
  • system.DeployOnBuild=true
  • system.DeployTarget=MSDeployPublish
  • system.MSDeployPublishMethod=WMSvc
  • system.DeployIISAppPath=[Default Web Site]
  • system.MSDeployServiceUrl=[yourServerDomainName]
  • system.Username=[username]
  • system.Password=[password]

I wrote a blog article with more detail here: Web Deploy (MS Deploy) from TeamCity - http://www.geekytidbits.com/web-deploy-ms-deploy-from-teamcity/

Here's what my config looks like:
Screenshot of Example System Properties within Teamcity

ヅ她的身影、若隐若现 2024-11-07 19:46:19

当 Visual Studio 未安装在构建服务器上时(绝对不应该如此),您需要开发计算机中的一些文件才能运行:

来自 C:\Program Files\开发计算机上的 MSBuild\Microsoft\VisualStudio\v10.0 文件夹将 WebWeb Applications 文件夹复制到生成服务器上的等效目录。

(来自 ​​未找到 MSBuild 目标包

When Visual Studio is not installed on the build server (which it should definitely not be) you need a few files from your dev machine to make things running:

From the C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0 folder on your dev machine copy the Web and Web Applications folders to the equivalent directory on your build server.

(from MSBuild target package not found)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文