MSBuild 任务 - 构建失败,因为在发布而不是调试中构建了一个解决方案 [英] MSBuild task - Build fails because one solution being built in release instead of debug

查看:18
本文介绍了MSBuild 任务 - 构建失败,因为在发布而不是调试中构建了一个解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 MSBuild 遇到了一个奇怪的问题,我想它可能只是环境问题.我们正在使用 MSBuild 构建许多单独的解决方案,它似乎可以在我的机器上运行.但在其他几台机器上,它无法正常工作.

I'm hitting a weird issue with MSBuild, and I'm thinking it might just be an environment issue. We're using MSBuild to build a number of separate solutions, and it seems to work on my machine. But on a couple of other machines, it's not working.

我已经找到了这个问题,看起来解决方案之一(或该解决方案中的一个项目)是在发布"中构建的,而其他所有东西都是在调试"中构建的.这会导致某些引用丢失 - 因此在发布"中构建的解决方案无法构建.我希望所有解决方案都构建在调试"中.以下是我们当前的 TFSBuild.proj 文件 - 我们做错了什么?

I've tracked down the issue, and it looks like one of the solutions (or one of the projects in that solution) is being built in "Release" when everything else is being built in "Debug". This causes some of the references to be missing - so the solution being built in "Release" fails to build. I want all solutions to be built in "Debug". In the following is our current TFSBuild.proj file - what are we doing wrong?

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="DesktopBuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <!-- TO EDIT BUILD TYPE DEFINITION

        To edit the build type, you will need to edit
        this file which was generated by the Create New
        Build Type wizard.  This file is under source
        control and needs to be checked out before
        making any changes.

        The file is available at -

            $/{TeamProjectName}/TeamBuildTypes/{BuildTypeName}

        where you will need to replace TeamProjectName
        and BuildTypeName with your Team Project and
        Build Type name that you created

        Checkout the file

          1. Open Source Control Explorer by selecting
             View -> Other Windows -> Source Control Explorer

          2. Ensure that your current workspace has a mapping for
             the $/{TeamProjectName}/TeamBuildTypes folder and
             that you have done a "Get Latest Version" on that
             folder

          3. Browse through the folders to
             {TeamProjectName}->TeamBuildTypes->{BuildTypeName} folder

          4. From the list of files available in this folder, right
             click on TfsBuild.Proj. Select 'Check Out For Edit...'

        Make the required changes to the file and save

        Checkin the file
          1. Right click on the TfsBuild.Proj file
             selected in Step 3 above and select
             'Checkin Pending Changes'

          2. Use the pending checkin dialog to save your
             changes to the source control

        Once the file is checked in with the
        modifications, all future builds using this
        build type will use the modified settings
    -->

    <!-- Do not edit this -->
    <Import Project="$(MSBuildExtensionsPath)MicrosoftVisualStudiov8.0TeamBuildMicrosoft.TeamFoundation.Build.targets" />
    <ProjectExtensions>

        <!--  DESCRIPTION
            The description is associated with a build
            type. Edit the value for making changes.
        -->
        <Description>
        </Description>

        <!--  BUILD MACHINE
            Name of the machine which will be used to
            build the solutions selected.
        -->
        <BuildMachine>xxxx-test</BuildMachine>
    </ProjectExtensions>
    <PropertyGroup>

      <!--  TEAM PROJECT
          The team project which will be built using
          this build type.
      -->
      <TeamProject>CFAST</TeamProject>

      <!--  BUILD DIRECTORY
          The directory on the build machine that will
          be used to build the selected solutions. The
          directory must be a local path on the build
          machine (e.g. c:uild).
      -->
      <BuildDirectoryPath>C:Buildrtcn</BuildDirectoryPath>
      <SolutionRoot Condition=" '$(IsDesktopBuild)'!='true' "
      >$(BuildDirectoryPath)w</SolutionRoot>

      <!--  DROP LOCATION
          The location to drop (copy) the built binaries
          and the log files after the build is complete.
          This location has to be a valid UNC path of
          the form \ServerShare. The build machine
          service account and application tier account
          need to have read write permission on this
          share.
      -->
      <DropLocation>\my-filesxx-filesBuild Dropxx</DropLocation>

      <!--  TESTING
          Set this flag to enable/disable running tests
          as a post build step.
      -->
      <RunTest>false</RunTest>
      <!--  WorkItemFieldValues
          Add/edit key value pairs to set values for
          fields in the work item created during the
          build process. Please make sure the field
          names are valid for the work item type being
          used.
      -->
      <WorkItemFieldValues>Symptom=build break;Steps To Reproduce=Start the build using Team Build</WorkItemFieldValues>
      <!--  CODE ANALYSIS
          To change CodeAnalysis behavior edit this
          value. Valid values for this can be
          Default,Always or Never.

          Default - To perform code analysis as per the individual project settings
          Always  - To always perform code analysis irrespective of project settings
          Never   - To never perform code analysis irrespective of project settings
       -->
      <RunCodeAnalysis>Never</RunCodeAnalysis>

      <!--  UPDATE ASSOCIATED WORK ITEMS
       Set this flag to enable/disable updating associated workitems on a successful build
      -->
      <UpdateAssociatedWorkItems>true</UpdateAssociatedWorkItems>
      <!-- Title for the work item created on build failure -->
      <WorkItemTitle>Build failure in build:</WorkItemTitle>
      <!-- Description for the work item created on build failure -->
      <DescriptionText>This work item was created by Team Build on a build failure.</DescriptionText>
      <!-- Text pointing to log file location on build failure -->
      <BuildlogText>The build log file is at:</BuildlogText>
      <!-- Text pointing to error/warnings file location on build failure -->
      <ErrorWarningLogText>The errors/warnings log file is at:</ErrorWarningLogText>
    </PropertyGroup>
    <ItemGroup>
        <!--  SOLUTIONS
            The path of the solutions to build. To
            add/delete solutions, edit this value. For
            example, to add a solution MySolution.sln,
            add following line -
             <SolutionToBuild Include="C:Project FilespathMySolution.sln" />

            To change the order in which the solutions are build, modify the order in
            which the solutions appear below.
        -->
        <SolutionToBuild Include="....xx1xxxSolutionxxx Solution.sln" />
        <SolutionToBuild Include="....xx2Build Solutionsxx xx xx BuildData Port Common Build.sln" />
        <SolutionToBuild Include="....xx3Build Solutionsxxx Buildxxx Build.sln" />
    </ItemGroup>
    <ItemGroup>
        <!--  CONFIGURATIONS
            The list of configurations to build. To
            add/delete configurations, edit this value.
            For example, to add a new configuration, add
            following lines -
                <ConfigurationToBuild Include="Debug|x86">
                    <FlavorToBuild>Debug</FlavorToBuild>
                    <PlatformToBuild>x86</PlatformToBuild>
                </ConfigurationToBuild>

            The Include attribute value should be unique
            for each ConfigurationToBuild node.
        -->
        <ConfigurationToBuild Include="Debug|Any CPU">
            <FlavorToBuild>Debug</FlavorToBuild>
            <PlatformToBuild>Any CPU</PlatformToBuild>
        </ConfigurationToBuild>
    </ItemGroup>
    <ItemGroup>
        <!--  TEST ARGUMENTS
            If the RunTest is set to true then the
            following test arguments will be used to run
            tests.

            To add/delete new testlist or to choose a
            metadata file (.vsmdi) file, edit this
            value. For e.g. to run BVT1 and BVT2 type
            tests mentioned in the Helloworld.vsmdi
            file, add the following -

            <MetaDataFile Include="C:Project FilesHelloWorldHelloWorld.vsmdi">
                <TestList>BVT1;BVT2</TestList>
            </MetaDataFile>

            Where BVT1 and BVT2 are valid test types
            defined in the HelloWorld.vsmdi file.

                MetaDataFile - Full path to test metadata file.
                TestList - The test list in the selected metadata file to run.

            Please note that you need to specify the
            vsmdi file relative to $(SolutionRoot)
        -->
        <MetaDataFile Include=" ">
            <TestList> </TestList>
        </MetaDataFile>
    </ItemGroup>
    <ItemGroup>
      <!--  ADDITIONAL REFERENCE PATH
          The list of additional reference paths to use
          while resolving references.

          For example,
              <AdditionalReferencePath Include="C:MyFolder" />
              <AdditionalReferencePath Include="C:MyFolder2" />
      -->
      <AdditionalReferencePath Include="....xxxxReference Files" />
      <AdditionalReferencePath Include="....xxxxBuild SupportSomeCoolLibrary" />
      <AdditionalReferencePath Include="....xxxx1.1Reference Files " />
    </ItemGroup>
</Project>

推荐答案

确保你所有的构建脚本都有这个部分:

Make sure that all your build scripts have this section:

<ConfigurationToBuild Include="Debug|Any CPU">
  <FlavorToBuild>Debug</FlavorToBuild>
  <PlatformToBuild>Any CPU</PlatformToBuild>
</ConfigurationToBuild>

并且它被设置为调试".

and that it is set to "Debug".

这篇关于MSBuild 任务 - 构建失败,因为在发布而不是调试中构建了一个解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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