When using CustomizableOutDir, I am having problems with the TFS Team Build command disabling MSTest.exe properly.
TFSBuild.rsp
/verbosity:diagnostic /p:CustomizableOutDir=true
TFSBuild.proj (fragment creation solutions)
<!-- code --> <SolutionToBuild Include="$(BuildProjectFolderPath)/../../foo.csproj"> <Properties>OutputPath=$(BinariesRoot)\WindowsServices\foo\</Properties> </SolutionToBuild> <!-- tests --> <SolutionToBuild Include="$(BuildProjectFolderPath)/../../test/test.sln"> <Targets>t1;t2</Targets> <Properties>OutputPath=$(BinariesRoot)\TestHarness\</Properties> </SolutionToBuild>
When using <Properties>OutputPath=$(BinariesRoot)\TestHarness\</Properties> and <Properties></Properties> I get the following error at the end of the assembly:
"C: \ build \ BuildType \ TFSBuild.proj" (TargetConfiguration target) (1:12) â (CoreTestConfiguration target) â
MSBUILD: warning MSB6003: The specified executable file for the task "MSTest.exe" could not be started. Invalid directory name
After finding this article, I added the following:
<Target Name="AfterCompile"> <ItemGroup> <SolutionOutputs Condition="'%(CompilationOutputs.Solution)' == '$(Solution)'" Include="%(RootDir)%(Directory)**\*.*" /> <ServiceOutputs Include="$(BinariesRoot)\WindowsServices\**\*.*" /> <TestHarnessOutputs Include="$(BinariesRoot)\TestHarness\*.*" /> </ItemGroup> <Copy SourceFiles="@(SolutionOutputs)" DestinationFolder="$(TeamBuildOutDir)" /> <Copy SourceFiles="@(ServiceOutputs)" DestinationFolder="$(TeamBuildOutDir)" /> <Copy SourceFiles="@(TestHarnessOutputs)" DestinationFolder="$(TeamBuildOutDir)" /> </Target>
What it gave:
(AfterCompile target) â
C: \ build \ BuildType \ TFSBuild.proj (289.5): error MSB3023: there is no destination for copying. Please put either "DestinationFiles" or "DestinationDirectory".
DestinationDirectory is not part of the http://schemas.microsoft.com/developer/msbuild/2003 schema, but I decided that I would try it anyway. So I changed all DestinationFolder to copy tasks on DestinationDirectory and, as expected, got the following:
(AfterCompile target) â
C: \ build \ BuildType \ TFSBuild.proj (288.44): error MSB4064: The "DestinationDirectory" parameter is not supported by the Copy task. Verify that a parameter exists on the task, and this is a custom publication property of the instance.
C: \ build \ BuildType \ TFSBuild.proj (288.5): error MSB4063: the "Copy" task could not be initialized by entering it Parameters.
Does anyone have CustomizableOutDir and MSTest working together according to their Team TFS build?
EDIT:
I found this discussion and applied this change:
<Target Name="BeforeTest"> <!-- The tests won't run if the binaries directory does not exist --> <MakeDir Directories="$(BinariesRoot)\%(ConfigurationToBuild.FlavorToBuild)" Condition="!Exists('$(BinariesRoot)\%(ConfigurationToBuild.FlavorToBuild)')" /> </Target>
The result is:
"C: \ build \ BuildType \ TFSBuild.proj" (Target RunTest) (1:11) â "C: \ build \ BuildType \ TFSBuild.proj" (TargetConfiguration target) (1:12) â (Goal CoreTestConfiguration) â
MSBUILD: warning MSB6006: "MSTest.exe" exited with code 1.