我如何获得TFS 2010将每个项目构建到单独的目录? [英] How can I get TFS 2010 to build each project to a separate directory?

查看:73
本文介绍了我如何获得TFS 2010将每个项目构建到单独的目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的项目中,我们希望我们的TFS构建将每个项目放置在放置文件夹下的自己的文件夹中,而不是将所有文件都放置在一个平面结构中.为了说明这一点,我们希望看到以下内容:

In our project, we'd like to have our TFS build put each project into its own folder under the drop folder, instead of dropping all of the files into one flat structure. To illustrate, we'd like to see something like this:

DropFolder/
  Foo/
    foo.exe
  Bar/
    bar.dll
  Baz
    baz.dll

这基本上与

This is basically the same question as was asked here, but now that we're using workflow-based builds, those solutions don't seem to work. The solution using the CustomizableOutDir property looked like it would work best for us, but I can't get that property to be recognized. I customized our workflow to pass it in to MSBuild as a command line argument (/p:CustomizableOutDir=true), but it seems MSBuild just ignores it and puts the output into the OutDir given by the workflow.

我查看了构建日志,可以看到CustomizableOutDir和OutDir属性都已在MSBuild的命令行参数中设置了.我仍然需要传入OutDir,以便最后可以将文件复制到TeamBuildOutDir.

I looked at the build logs, and I can see that the CustomizableOutDir and OutDir properties are both getting set in the command line args to MSBuild. I still need OutDir to be passed in so that I can copy my files to TeamBuildOutDir at the end.

有人知道为什么我的CustomizableOutDir参数不能被识别,或者是否有更好的方法来实现这一点?

Any idea why my CustomizableOutDir parameter isn't getting recognized, or if there's a better way to achieve this?

推荐答案

我想出了一种不错的方法.事实证明,由于可以将OutDir设置为工作流中所需的任何内容,因此,如果将其设置为空字符串,MSBuild将改为使用项目特定的OutputPath.这使我们更加灵活.这是我的整个解决方案(基于默认的构建工作流程):

I figured out a nice way to do it. It turns out that since you can set the OutDir to whatever you want within the workflow, if you set it to the empty string, MSBuild will instead use the project-specific OutputPath. That lets us be a lot more flexible. Here's my entire solution (based on the default build workflow):

在运行MSBuild"任务中,将OutDir设置为空字符串.在同一任务中,将CommandLineArguments设置为类似于以下内容.这将使您可以从项目中引用TFS默认的OutDir:

In the Run MSBuild task, set OutDir to the empty string. In that same task, set your CommandLineArguments to something like the following. This will allow you to have a reference to the TFS default OutDir from your project:

String.Format("/p:CommonOutputPath=""{0}\\""", outputDirectory)

在要复制到放置文件夹的每个项目中,如下设置OutputPath:

In each project you want copied to the drop folder, set the OutputPath like so:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <OutputPath Condition=" '$(CommonOutputPath)'=='' ">bin\Release\</OutputPath>
    <OutputPath Condition=" '$(CommonOutputPath)'!='' ">$(CommonOutputPath)YourProjectName\bin\Release\</OutputPath>
</PropertyGroup>

检入所有内容,您应该拥有一个可以正常工作的版本,该版本将每个项目部署到放置文件夹下的自己的文件夹中.

Check everything in, and you should have a working build that deploys each of your projects to its own folder under the drop folder.

这篇关于我如何获得TFS 2010将每个项目构建到单独的目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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