2013-12-12 6 views
0

나는 체크인시 프로젝트를 만들 수있는 방아쇠를 가지고있다. 그러나 어떤 경우에는 수표를 추가하고 빌드를 취소하고 싶습니다.TFSBuild.proj의 작업에서 빌드를 취소하려면 어떻게해야합니까?

확인할 조건이있는 작업이 생성되었습니다.

<Target Name="BeforeCompile"> 
    <CheckIfBuildNeeded> 
    ..... 
    </CheckIfBuildNeeded> 
</Target> 

그래서, 대답은 내가 작업의 Execute() 방법 또는 다른에서 구축 중지/취소 할 수있는 방법이다 : 나는 CheckIfBuildNeeded 내 작업의 이름과 같은 코드로 TFSBuild.proj 파일을 사용하여이 작업을 실행할 수 있습니다 장소? Build 객체를 얻으려면 어떻게해야합니까?

이 코드로 TFS에서 빌드를 얻을 수 있다는 것을 알고 있습니다. 그러나 빌드 I로 무언가를하려면 당연히 ID임을 알아야합니다.

TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer("http://foo.bar/tfs"); 
IBuildServer buildServer = (IBuildServer)tfs.GetService(typeof(IBuildServer)); 
+0

TFS 버전은 무엇입니까? –

+0

@DylanSmith TFS 버전은 2012이지만 TFSBuild.proj 스키마를 2008 년부터 사용합니다. –

답변

1

Error Task을 살펴보십시오.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    <Target Name="ValidateCommandLine"> 
     <Error 
      Text=" The 0 property must be set on the command line." 
      Condition="'$(0)' == ''" /> 
     <Error 
      Text="The FREEBUILD property must be set on the command line." 
      Condition="'$(FREEBUILD)' == ''" /> 
    </Target> 
    ... 
</Project>