2011-04-13 4 views
1

로컬 또는 TFS2010 빌드 중에 내 nUnit 테스트를 실행할 사용자 지정 MSBuild 작업을 만들려고합니다. 이 스크립트는 로컬에서 훌륭하게 작동하지만 TFS 빌드 서버에서 테스트 DLL을 찾을 수없는 것 같습니다. 단위 테스트를 실행하기 위해 MSBuild.ExtensionPack의 작업을 사용하고 있습니다.MSBuild 및 TFS2010 DLL 찾기

어셈블리 목록은 항상 비어 있습니다. TargetDir은 "C : \ Builds \ 2 \ Product1 \ ci.product1.acme.com \ Binaries \"경로를 보여줍니다. 또한 변경없이 AfterBuild 대상 대신 CoreCompile 대상 다음에 대상을 시작하려고했습니다.

나는 아마 어리석은 실수를 저질렀지 만, 지금은 나를 죽이는 모드에 있습니다. 도와주세요.

<PropertyGroup> 
    <RunTFSBuild>false</RunTFSBuild> 
    <SolutionDirectory>$(MSBuildProjectDirectory)\..</SolutionDirectory> 
    <ExtensionTasksPath>$(SolutionDirectory)\_shared\MSBuild\</ExtensionTasksPath> 
    <TPath>$(ExtensionTasksPath)MSBuild.ExtensionPack.tasks</TPath> 
    <NUnitOutputFile>$(SolutionDirectory)\nUnitResults.xml</NUnitOutputFile> 
    <NUnitOutputFileAsMsTest>$(SolutionDirectory)\nUnitResultsAsMsTestResults.xml</NUnitOutputFileAsMsTest> 
    <ToolPath>$(SolutionDirectory)\_shared\MSBuild\nUnit_2.5.7</ToolPath> 
    </PropertyGroup> 
    <Import Project="$(TPath)" /> 

    <Target Name="AfterBuild">  
    <CallTarget Condition="$(RunTFSBuild)!='true'" Targets="NUnitTestRunner" /> 
    <CallTarget Condition="$(RunTFSBuild)=='true'" Targets="NUnitTestRunner;TFSNUnitTestRunner" /> 
    </Target> 
    <Target Name="NUnitTestRunner"> 
    <ItemGroup > 
     <Assemblies Include="$(SolutionDirectory)\**\bin\$(Configuration)\*.nUnit.Tests.dll" /> 
    </ItemGroup> 
    <ItemGroup Condition="$(RunTFSBuild)=='true'"> 
     <Assemblies Include="$(TargetDir)\**\*.nUnit.Tests.dll" /> 
    </ItemGroup> 

    <Message Text="SolutionDirectory=$(SolutionDirectory)" /> 
    <Message Text="ExtensionTasksPath=$(ExtensionTasksPath)" /> 
    <Message Text="TargetDir=$(TargetDir)" /> 
    <Message Text="TPath=$(TPath)" /> 
    <Message Text="NUnitOutputFile=$(NUnitOutputFile)" /> 
    <Message Text="Running nUnit tests from: $(Assemblies)" /> 

답변

1

1) (그냥, 프로젝트의 청소를 할 수있다 섹션 교환) 속성 RunTFSBuild에게

<RunTFSBuild Condition="'$(RunTFSBuild)'==''">false</RunTFSBuild> 

2를 변경하려고하지만 때문에 CallTarget의 일부 제한)에 매우 중요 할 수 있습니다

<Target Name="AfterBuild" DependsOnTargets="NUnitTestRunner;TFSNUnitTestRunner" />  
<Target Name="TFSNUnitTestRunner" 
     Condition="$(RunTFSBuild)=='true'"> 
    <!-- TFSNUnitTestRunner Body --> 
</Target> 

3) 일 경우) 및 2) 진단 (msbuld 키 /V에 빌드의 자세한 정보를 설정하는 것이 도움이 시도 될 willn't : DIAG). 로그에서 TFSNUnitTestRunner의 모든 호출을 찾아 보면 실제로 TFS에서 발생한 일이 표시됩니다.

편집 : * 조립품 *은 ItemGroup으로 선언됩니다. 항목에 액세스 (어셈블리) @을 사용

<Message Text="Running nUnit tests from: @(Assemblies)" /> 

재산권 $ (어셈블리)항상 귀하의 경우 비어있을 것이다.

+0

1 & 2에 대해서는 대상이 잘 돌아가고있어 도움이되지 않습니다. 진단에 설정된 자세한 정보 표시로 실행 중이며 유용한 정보가 표시되지 않습니다. – chief7

+0

무슨 소리 야? NUnitTestRunner 및/또는 TFSNUnitTestRunner에 대한 호출을 찾았습니까? 그렇지 않다면 문제는 더 높습니다. –

+0

나는 전체 시간 동안이 표적을 가지고 있었고 그것들은 달리고있다. (나는 전체 MSBuild 스크립트를 게시하지 않았다.) NUnitTestRunner 대상 내에서 TFS 빌드 서버에서 실행할 때 어셈블리는 항상 비어 있습니다. – chief7