2012-07-24 3 views
0

나는 다음과 같은 대상이 :은 MSBuild 메시지 출력 두 번

<Target Name="SetBinariesLocationForTeamBuild"> 
    <!--We add the following location paths because TFS Team Build first copies to \sources and \binaries folders 
    rather than simply having the binaries in a \bin folder of the source folder 
    at this point the build will be at: C:\Builds\3\x.Int.MIS\SupportBTDF\Sources\x.Int.MIS\Dev\V1.0\Src\Solutions\MIS\x.Int.MIS.Deployment 
    so we need to go up 4 levels before going back down to binaries--> 
    <Message Text="Value of TeamBuild=$(TeamBuild)"/> 

    <Message Text="MSBuildProjectName: $(MSBuildProjectName)"/> 
    <Message Text="MSBuildStartupDirectory: $(MSBuildStartupDirectory)"/> 
    <Message Text="MSBuildProjectDirectory: $(MSBuildProjectDirectory)"/> 
    <Message Text="MSBuildProjectFullPath: $(MSBuildProjectFullPath)"/> 
    <Message Text="MSBuildThisFileDirectory: $(MSBuildThisFileDirectory)"/> 

    <ItemGroup> 
     <Schemas Condition ="'$(TeamBuild)' == 'True'" Include="x.Int.MIS.Schemas.dll"> 
     <LocationPath>..\..\..\..\..\..\..\..\binaries\</LocationPath> 
     </Schemas> 
    </ItemGroup> 

    <ItemGroup> 
     <Pipelines Condition ="'$(TeamBuild)' == 'True'" Include="x.Int.Pipelines.dll"> 
     <LocationPath>..\..\..\..\..\..\..\..\binaries\</LocationPath> 
     </Pipelines> 
    </ItemGroup> 

    <ItemGroup> 
     <PipelineComponents Condition ="'$(TeamBuild)' == 'True'" Include="x.Int.PipelineComponents.dll"> 
     <LocationPath>..\..\..\..\..\..\..\..\binaries\</LocationPath> 
     </PipelineComponents> 
    </ItemGroup> 

    <ItemGroup> 
     <Orchestrations Condition ="'$(TeamBuild)' == 'True'" Include="x.Int.Orchestrations.dll"> 
     <LocationPath>..\..\..\..\..\..\..\..\binaries\</LocationPath> 
     </Orchestrations> 
    </ItemGroup> 

    <ItemGroup> 
     <Transforms Condition ="'$(TeamBuild)' == 'True'" Include="x.Int.Transforms.dll"> 
     <LocationPath>..\..\..\..\..\..\..\..\binaries\</LocationPath> 
     </Transforms> 
    </ItemGroup> 

    <Message Text="What is Schemas location path: %(Schemas.LocationPath)"/> 
    <Message Text="What is Pipelines location path: %(Pipelines.LocationPath)"/> 

    </Target> 

의 I/P를 전달 명령 줄에서 프로젝트를 실행 : TeamBuild = 참/t : SetBinariesForTeamBuild합니다. 출력은 ... 나를 매우 당황이

마이크로 소프트 (R) 엔진 버전 4.0.30319.1 [마이크로 소프트 .NET Framework 버전 4.0.30319.269] 저작권 (C) Microsoft의 2007 모든 권리는 저작권자의 소유를 구축 할 수 있습니다.

Build started 24/07/2012 16:59:08. 
Project "C:\Builds\3\x.Int.MIS\SupportBTDF\Sources\x.Int.MIS\Dev\V1.0\Src\Solutions\MIS\x.Int.MIS.Deployment\x.Int.MIS.Deployment.btdfproj" on node 1 (SetBinariesLocationForTeamBuild target(s)). 
SetBinariesLocationForTeamBuild: 
    Value of TeamBuild=True 
    MSBuildProjectName: x.Int.MIS.Deployment 
    MSBuildStartupDirectory: C:\Builds\3\x.Int.MIS\SupportBTDF\Sources\x.Int.MIS\Dev\V1.0\Src\Solutions\MIS\x.Int.MIS.Deployment 
    MSBuildProjectDirectory: C:\Builds\3\x.Int.MIS\SupportBTDF\Sources\x.Int.MIS\Dev\V1.0\Src\Solutions\MIS\x.Int.MIS.Deployment 
    MSBuildProjectFullPath: C:\Builds\3\x.Int.MIS\SupportBTDF\Sources\x.Int.MIS\Dev\V1.0\Src\Solutions\MIS\x.Int.MIS.Deployment\x.Int.MIS.Deployment.btdfproj 
    MSBuildThisFileDirectory: C:\Builds\3\x.Int.MIS\SupportBTDF\Sources\x.Int.MIS\Dev\V1.0\Src\Solutions\MIS\x.Int.MIS.Deployment\ 
    What is Schemas location path: ..\x.Int.MIS.Schemas\bin\Debug 
    What is Schemas location path: ..\..\..\..\..\..\..\..\binaries\ 
    What is Pipelines location path: ..\x.Int.MIS.Pipelines\bin\Debug 
    What is Pipelines location path: ..\..\..\..\..\..\..\..\binaries\ 
Done Building Project "C:\Builds\3\x.Int.MIS\SupportBTDF\Sources\x.Int.MIS\Dev\V1.0\Src\Solutions\MIS\x.Int.MIS.Deployment\x.Int.MIS.Deployment.btdfproj" (SetBinariesLocationForTeamBuild target(s)). 

Build succeeded. 
    0 Warning(s) 
    0 Error(s) 

Time Elapsed 00:00:00.17 

나는 팔과 하나가 될 위치 경로를 원하는 .. \하지만 아니다 - 어떤 생각이 왜, 왜 두 번 인쇄됩니다!?

답변

1

@ (스키마) 및 @ (파이프 라인) 항목 배열은 각각 다른 항목 튜플을 추가하거나 그렇지 않으면 인쇄 할 수 없습니다. 이런 일이 발생하는 다른 목표가 있어야합니다. 정확한 명령 줄을 사용하여 프로젝트에서 msbuild를 실행하는 경우 추가 대상은 프로젝트의 InitialTargets에있는 항목이거나이 항목에 대한 BeforeTargets 또는 AfterTargets 참조로 위의 대상에 연결된 대상이어야합니다 .

+0

그게 전부 야! 브라이언 감사합니다. '배포'라는 또 다른 목표가있었습니다. 이것은 또한 내가 오버라이드하려고했던 것과 같은 이름을 가진 아이템 그룹을 가지고있었습니다. 이 문제의 해결책은 내 사용자 지정 대상 외부의 LocationPath 속성으로 할당을 이동하는 것이 었습니다. 그들은 이제 특정 대상이 아닌 상위 프로젝트에 참여합니다. 진단 작업을 위해 메시지 작업을 사용할 수 있도록 사용자 지정 대상 만 필요했습니다. 메시지 작업은 대상 내에 포함되어야합니다. –