MSTest.TestAdapter.targets 5.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  3. <PropertyGroup>
  4. <EnableMSTestV2CopyResources Condition=" '$(EnableMSTestV2CopyResources)' == '' ">true</EnableMSTestV2CopyResources>
  5. </PropertyGroup>
  6. <PropertyGroup Condition=" '$(UseWinUI)' == 'true' ">
  7. <__TestAdapterPlatformServicesRoot>$(MSBuildThisFileDirectory)winui/</__TestAdapterPlatformServicesRoot>
  8. </PropertyGroup>
  9. <PropertyGroup Condition=" '$(UseWinUI)' != 'true' ">
  10. <__TestAdapterPlatformServicesRoot>$(MSBuildThisFileDirectory)</__TestAdapterPlatformServicesRoot>
  11. </PropertyGroup>
  12. <ItemGroup>
  13. <TestAdapterContent Include="$(MSBuildThisFileDirectory)..\_common\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll">
  14. <Link>Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll</Link>
  15. <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  16. <Visible>False</Visible>
  17. </TestAdapterContent>
  18. <TestAdapterContent Include="$(MSBuildThisFileDirectory)..\_common\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll">
  19. <Link>Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll</Link>
  20. <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  21. <Visible>False</Visible>
  22. </TestAdapterContent>
  23. <TestAdapterContent Include="$(__TestAdapterPlatformServicesRoot)Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll">
  24. <Link>Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll</Link>
  25. <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  26. <Visible>False</Visible>
  27. </TestAdapterContent>
  28. <TestAdapterContent Include="$(MSBuildThisFileDirectory)\Microsoft.TestPlatform.AdapterUtilities.dll">
  29. <Link>Microsoft.TestPlatform.AdapterUtilities.dll</Link>
  30. <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  31. <Visible>False</Visible>
  32. </TestAdapterContent>
  33. </ItemGroup>
  34. <ItemGroup>
  35. <!-- Including `@(TestAdapterContent)` in the `None` ItemGroup to get the `CopyToOutputDirectory`
  36. behavior be default, package consumers can opt-out of this behavior
  37. by removing `@(TestAdapterContent)` from the `None` ItemGroup
  38. i.e. `<None Remove="@(TestAdapterContent)" />` -->
  39. <None Include="@(TestAdapterContent)" />
  40. </ItemGroup>
  41. <Target Name="GetMSTestV2CultureHierarchy">
  42. <!-- Only traversing 5 levels in the culture hierarchy. This is the maximum length for all cultures and should be sufficient to get to a culture name that maps to a resource folder we package.
  43. The root culture name for all cultures is invariant whose name is ''(empty) and the parent for invariant culture is invariant itself.(https://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.parent(v=vs.110).aspx.)
  44. So the below code should not break build in any case. -->
  45. <ItemGroup>
  46. <CurrentUICultureHierarchy Include="$([System.Globalization.CultureInfo]::CurrentUICulture.Name)" />
  47. <CurrentUICultureHierarchy Include="$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Name)" Condition=" '$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Name)' != '' "/>
  48. <CurrentUICultureHierarchy Include="$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Parent.Name)" Condition=" '$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Parent.Name)' != '' "/>
  49. <CurrentUICultureHierarchy Include="$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Parent.Parent.Name)" Condition=" '$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Parent.Parent.Name)' != '' "/>
  50. <CurrentUICultureHierarchy Include="$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Parent.Parent.Parent.Name)" Condition=" '$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Parent.Parent.Parent.Name)' != '' "/>
  51. </ItemGroup>
  52. </Target>
  53. <!-- Copy resources over to $(TargetDir) if this is a localized build. -->
  54. <Target Name="CopyMSTestV2Resources" BeforeTargets="PrepareForBuild" Condition=" '$(EnableMSTestV2CopyResources)' == 'true' " DependsOnTargets="GetMSTestV2CultureHierarchy">
  55. <PropertyGroup>
  56. <CurrentUICultureHierarchy>%(CurrentUICultureHierarchy.Identity)</CurrentUICultureHierarchy>
  57. </PropertyGroup>
  58. <ItemGroup>
  59. <MSTestV2Files Include="$(MSBuildThisFileDirectory)..\_common\*.dll" />
  60. </ItemGroup>
  61. <ItemGroup>
  62. <Content Include="@(MSTestV2Files->'%(RootDir)%(Directory)$(CurrentUICultureHierarchy)\%(FileName).resources.dll')"
  63. Condition="Exists('%(RootDir)%(Directory)$(CurrentUICultureHierarchy)\%(FileName).resources.dll')">
  64. <Link>$(CurrentUICultureHierarchy)\%(FileName).resources.dll</Link>
  65. <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  66. <BaseAssemblyFullPath>%(FullPath)</BaseAssemblyFullPath>
  67. <Visible>False</Visible>
  68. </Content>
  69. </ItemGroup>
  70. </Target>
  71. </Project>