Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1317
  • Last Modified:

Team Build fails while copying test results to drop directory

We're developing an automated Team Build in Visual Studio 2008.  All the code compiles and all the tests run successfully - but the overall build fails at the very end with this error message:

"The drop share directory <whatever> could not be accessed"

This is basically because MSBuild wants to copy the test results to the drop share directory, which it's just created, but doesn't seem to have permissions to!  Since we're not willing to put the drop folder on the TFS server machine (which seems to be the general advice for this problem), we need to disable this final step, the publishing of test results to the drop folder.  We had a workaround in place in our TFSBuild.proj file when we ran it in Visual Studio 2005, but apparently MSBUILD has changed significantly in VS2008, and this workaround no longer works.  The question is: what entries do I need to add to TFSBuild.proj to bypass the step of copying test results to the drop folder so that the build succeeds?
0
BSWatts
Asked:
BSWatts
  • 2
2 Solutions
 
Mohamed OsamaSenior IT ConsultantCommented:
- are we talking about TFS2005 or 2008, which version of the server product exactly ? 
-Is the account that starts the build the TFS builtin service account ?, this should also be a domain account.
- Make sure this TFS services account is an admin on the server where the binaries are dropped, or at least  has Read/Write access (both share & security) on the root directory of the drop  location.
if I have misunderstood you, can you please post the log with the exact errors .


0
 
BSWattsAuthor Commented:
Thanks for your response.

This is TFS2008.  The account running the build service is a domain account with permissions to the necessary folders, and also a local admin on the build machine.

This question is not about permissions.  We've already spent quite a bit of time trying to solve this problem via permissions.  For a sample of the existing discussions, you can look here:

http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/0e9e30f9-68b0-4bb0-b21b-56c8eb1a562f

Since we don't care about publishing the build results, we have decided to skip that step in our build.  This question asks how to modify TFSBuild.proj to accomplish that.

I had already found a workaround for this issue in Visual Studio/TFS 2005.  It basically adds XML to TFSBuild.proj to override one of the targets in Microsoft.TeamFoundation.Build.targets in such a way that the test results publication is skipped.  Here is that code:

<Target Name="RunTestWithConfiguration" >
    <TeamBuildMessage
          Tag="Configuration"
          Condition=" '$(IsDesktopBuild)'!='true' "
          Value="$(Flavor)" />

    <TeamBuildMessage
          Tag="Platform"
          Condition=" '$(IsDesktopBuild)'!='true' "
          Value="$(Platform)" />

    <!-- SearchPathRoot for not Any CPU -->
    <CreateProperty
          Condition=" '$(Platform)'!='Any CPU' "
          Value="$(BinariesRoot)\$(Platform)\$(Flavor)\" >
      <Output TaskParameter="Value" PropertyName="SearchPathRoot" />
    </CreateProperty>

    <!-- SearchPathRoot for Any CPU -->
    <CreateProperty
          Condition=" '$(Platform)'=='Any CPU' "
          Value="$(BinariesRoot)\$(Flavor)\" >
      <Output TaskParameter="Value" PropertyName="SearchPathRoot" />
    </CreateProperty>

    <!-- Test task that doesn't publish results -->
    <TestToolsTask
          Condition=" '%(MetaDataFile.Identity)'!='' "
          SearchPathRoot="$(SearchPathRoot)"
          PathToResultsFilesRoot="$(TestResultsRoot)"
          MetaDataFile="%(MetaDataFile.Identity)"
          RunConfigFile="$(RunConfigFile)"
          TestLists="%(MetaDataFile.TestList)"
          ContinueOnError="true" />
  </Target>

However, this doesn't work in Visual Studio 2008 - for one thing, there's no longer a target called RunTestWIthConfiguration.  As near as I can tell, the appropriate target is now called CoreTestConfiguration - but I haven't been able to modify it to get everything to work.  I need for someone to give me a chunk of XML that I can plug into TFSBuild.proj which will cause the test results publication to be skipped.

Thanks!
0
 
BSWattsAuthor Commented:
Hey, I figured it out!

So, basically what you do is, you copy the XML section for the target in question ("CoreTestConfiguration") from Microsoft.TeamFoundation.Build.targets (which is in the MSBuild directory) and paste it into TFSBuild.proj - this way, the TFSBuild.proj version overrides the Microsoft.TeamFoundation.Build.targets one.  Then you change the section relating to the build scenario in question - in this case, "<!-- MetaDataFile tests for non-desktop builds. -->"  For this section, you remove the items that relate to copying the test results (this is the tricky part: knowing which items these are).  The ones I removed are: BuildFlavor, Platform, PublishServer, PublishBuild, and TeamProject.  The resulting XML is shown below:

<Target Name="CoreTestConfiguration"
          DependsOnTargets="$(CoreTestConfigurationDependsOn)"
          Outputs="@(TestOutputs)">

    <Warning Condition=" '$(V8TestToolsTask)'=='true' and '$(TestNames)'!='' "
             Text="Warning: The TestNames property cannot be used in in combination with the V8 TestToolsTask and will be ignored." />
    <Warning Condition=" '$(V8TestToolsTask)'=='true' and '@(LocalTestContainer)' != '' "
             Text="Warning: The TestContainer item group cannot be used in combination with the V8 TestToolsTask and will be ignored." />

    <PropertyGroup>
      <ContinueOnTestError Condition=" '$(StopOnTestFailure)' != 'true' ">true</ContinueOnTestError>
      <ContinueOnTestError Condition=" '$(StopOnTestFailure)' == 'true' ">false</ContinueOnTestError>
    </PropertyGroup>

    <!-- MetaDataFile tests for non-desktop builds. -->
    <TestToolsTask
          Condition=" '$(IsDesktopBuild)'!='true' and '$(V8TestToolsTask)'!='true' and '%(LocalMetaDataFile.Identity)' != '' "
          SearchPathRoot="$(OutDir)"
          PathToResultsFilesRoot="$(TestResultsRoot)"
          MetaDataFile="%(LocalMetaDataFile.Identity)"
          RunConfigFile="$(RunConfigFile)"
          TestLists="%(LocalMetaDataFile.TestList)"
          TestNames="$(TestNames)"
          ContinueOnError="$(ContinueOnTestError)" />

    <!-- 8.0 MetaDataFile tests for non-desktop builds. -->
    <TestToolsTask
          Condition=" '$(IsDesktopBuild)'!='true' and '$(V8TestToolsTask)'=='true' and '%(LocalMetaDataFile.Identity)' != '' "
          BuildFlavor="$(Configuration)"
          Platform="$(Platform)"
          PublishServer="$(TeamFoundationServerUrl)"
          PublishBuild="$(BuildNumber)"
          SearchPathRoot="$(OutDir)"
          PathToResultsFilesRoot="$(TestResultsRoot)"
          MetaDataFile="%(LocalMetaDataFile.Identity)"
          RunConfigFile="$(RunConfigFile)"
          TestLists="%(LocalMetaDataFile.TestList)"
          TeamProject="$(TeamProject)"
          ContinueOnError="$(ContinueOnTestError)" />

    <!-- TestContainer tests for non-desktop builds. -->
    <TestToolsTask
            Condition=" '$(IsDesktopBuild)'!='true' and '$(V8TestToolsTask)'!='true' and '@(LocalTestContainer)' != '' "
            BuildFlavor="$(Configuration)"
            Platform="$(Platform)"
            PublishServer="$(TeamFoundationServerUrl)"
            PublishBuild="$(BuildUri)"
            SearchPathRoot="$(OutDir)"
            PathToResultsFilesRoot="$(TestResultsRoot)"
            RunConfigFile="$(RunConfigFile)"
            TestContainers="@(LocalTestContainer)"
            TeamProject="$(TeamProject)"
            TestNames="$(TestNames)"
            ContinueOnError="$(ContinueOnTestError)" />

    <!-- MetaDataFile tests for desktop builds. -->
    <TestToolsTask
          Condition=" '$(IsDesktopBuild)'=='true' and '$(V8TestToolsTask)'!='true' and '%(MetaDataFile.Identity)' != '' "
          SearchPathRoot="$(OutDir)"
          PathToResultsFilesRoot="$(TestResultsRoot)"
          MetaDataFile="%(MetaDataFile.Identity)"
          RunConfigFile="$(RunConfigFile)"
          TestLists="%(MetaDataFile.TestList)"
          TestNames="$(TestNames)"
          ContinueOnError="$(ContinueOnTestError)" />

    <!-- 8.0 MetaDataFile tests for desktop builds. -->
    <TestToolsTask
          Condition=" '$(IsDesktopBuild)'=='true' and '$(V8TestToolsTask)'=='true' and '%(MetaDataFile.Identity)' != '' "
          SearchPathRoot="$(OutDir)"
          PathToResultsFilesRoot="$(TestResultsRoot)"
          MetaDataFile="%(MetaDataFile.Identity)"
          RunConfigFile="$(RunConfigFile)"
          TestLists="%(MetaDataFile.TestList)"
          ContinueOnError="$(ContinueOnTestError)" />

    <!-- TestContainer tests for desktop builds. -->
    <TestToolsTask
            Condition=" '$(IsDesktopBuild)'=='true' and '$(V8TestToolsTask)'!='true' and '@(LocalTestContainer)' != '' "
            SearchPathRoot="$(OutDir)"
            PathToResultsFilesRoot="$(TestResultsRoot)"
            RunConfigFile="$(RunConfigFile)"
            TestContainers="@(LocalTestContainer)"
            TestNames="$(TestNames)"
            ContinueOnError="$(ContinueOnTestError)" />

    <!-- Populate TestOutputs with MetaData Files and Test Containers. -->
    <ItemGroup>
      <!-- TestContainer tests for non-desktop and desktop builds. -->
      <TestOutputs Condition=" '@(LocalTestContainer)' != '' "
                   Include="%(LocalTestContainer.Identity)">
        <Platform>$(Platform)</Platform>
        <Configuration>$(Configuration)</Configuration>
      </TestOutputs>
      <!-- MetaDataFile tests for non-desktop builds. -->
      <TestOutputs Condition=" '$(IsDesktopBuild)'!='true' and '%(LocalMetaDataFile.Identity)' != '' "
                   Include="%(LocalMetaDataFile.Identity)">
        <Platform>$(Platform)</Platform>
        <Configuration>$(Configuration)</Configuration>
      </TestOutputs>
      <!-- MetaDataFile tests for desktop builds. -->
      <TestOutputs Condition=" '$(IsDesktopBuild)'=='true' and '%(MetaDataFile.Identity)' != '' "
                   Include="%(MetaDataFile.Identity)">
        <Platform>$(Platform)</Platform>
        <Configuration>$(Configuration)</Configuration>
      </TestOutputs>
    </ItemGroup>
  </Target>

This resulted in the results not being copied, and a successful build!
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now