visual-studio-2008 - Team Foundation Build 在平面目录结构中下降

标签 visual-studio-2008 msbuild tfsbuild

我正在尝试在我们的 TF 服务器上“修复”一个构建,它将所有内容都放入一个大的平放文件夹中(而不是像本地构建那样在单独的项目转储中),我有点沮丧 -老实说,这是我第一次使用 MSBuild,这有点被我抛弃了 - 这不是我从头开始配置的构建文件。

我在网上找到了一堆解决方案,大多数指向this blog,这看起来不错。不幸的是,它似乎根本无法解决我的问题。

在 TFSBuild.proj 中,我有一段代码,如下所示:

<SolutionToBuild Include="$(BuildProjectFolderPath)/../../mySolution.sln">
 <Targets>SomeProject\Project</Targets>
  <Properties>
    CustomizableOutDir=true;
  </Properties>
</SolutionToBuild>

据我所知, CustomizableOutDir 确实设置为 true ,据称应该保留目录结构。我尝试按照博客中的说明编辑一些项目文件,就像这样......
<Target Name="AfterCompile" Condition="'$(TeamBuildOutDir)' != ''">
    <ItemGroup>
       <CompileOutputs Include="$(OutDir)\**\*" />
    </ItemGroup>
    <Copy 
      SourceFiles="@(CompileOutputs)"
      DestinationFolder=
      "$(TeamBuildOutDir)\ProjectName\%(RecursiveDir)" />
</Target>

但这行为很奇怪 - 如果我编辑几个项目文件,我开始得到看起来我可能正在接近正确的解决方案,但仍然不够好 - 我得到一个包含 MyProj1 和 MyProj2 等文件夹的目录结构,但 MyProj2 似乎到 of 将 MyProj1 的所有输出都转储到其中(MyProj1 像我希望的那样工作)。最重要的是,drop 文件夹仍将其他所有内容转储到一个大 drop 中(目录包含此 drop 的副本)。

有没有人知道是什么导致 CustomizableOutDir 无法按预期运行?还是我的 csproj 文件代码有问题?

最佳答案

我已经看到了一些关于如何将 CustomizableOutDir 属性传递给 msbuild 以获得解决方案的建议。

  • 正如您在问题中提供的,添加 <Properties>CustomizableOutDir=true</Properties>对于 SolutionToBuild 项。 ( What's the best way to get TFS to output each project to its own directory? )
  • 添加 <CustomizableOutDir>true</CustomizableOutDir>到主 PropertyGroup ( TFS Build 2008 - Custom output directories )
  • 添加 /p:CustomizableOutDir=true到 TFSBuild.rsp ( TFS Build 2008 - Custom output directories )

  • 我已经尝试了所有三种方法,最后一个选项(TFSBuild.rsp 命令行选项)是我唯一可以使用的方法。我将其与 csproj 文件中每个 OutputPath 的条件结合起来,而不是 AfterCompile 目标。例如。
    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
        <OutputPath Condition=" '$(TeamBuildOutDir)'=='' ">bin\debug\</OutputPath>
        <OutputPath Condition=" '$(TeamBuildOUtDir)'!='' ">$(TeamBuildOutDir)projectName</OutputPath>
    </PropertyGroup> 
    

    关于visual-studio-2008 - Team Foundation Build 在平面目录结构中下降,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3195648/

    相关文章:

    MSBuild LibSass 错误

    deployment - TeamCity - 从不同的构建配置引用构建号

    msbuild - 巡航控制 .NET 4.0 MSBUILD 记录器

    tfs - TFS构建特定的变更集并使用变更集编号进行部署

    c# - 通过 REST API 附加要构建的工作项

    asp.net - 尝试使用 Visual Studio 2008 附加到 ASP.NET 进程时出现 "Mixed mode debugging is not supported on Windows 64-bit platforms"

    visual-studio-2008 - VS 2008调试: How to filter and iterate collections in immediate debug window?

    c++ - Visual Studio 2008 中字符串表的语言

    c++ - 使用boost math的编译问题

    c# - 如果只有最后一次构建通过 TFS 插件失败,则 TFS 成功构建警报电子邮件