/
githubmirror
/
aspnetcore
Обзор
Документация
Войти
/
githubmirror
/
aspnetcore
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
eng/targets/FunctionalTestWithAssets.targets
48 строк
2 KB
Matt Mitchell
Enable unified build (#54084)
19 мар 2024, 02:08
Не верифицирован
19 мар 2024, 02:08
aefa4ca
Код
Авторство
О чём код?
<Project> <!-- Test asset publication support intended for case where an asset is referenced in a single test project. References in more than one or two test projects would slow the build because each restore or publish operation gets unique (per-test project) global properties. Hook into Build target in addition to Publish (for Helix), RunTests (for Arcade), and VSTest (for dotnet test) because VS does not use a target when discovering or executing tests (examines test assembly instead). Need those targets too to ensure everything is up-to-date when executing tests. --> <Target Name="PublishTestAssets" BeforeTargets="Build;Publish;RunTests;VSTest" Condition=" '$(ExcludeFromBuild)' != 'true' AND ('$(DotNetBuild)' != 'true' or '$(DotNetBuildTests)' == 'true') AND '@(TestAssetProjectReference->Count())' != '0' "> <ItemGroup> <_ProjectsToPublish Include="@(TestAssetProjectReference)" /> <!-- Always Publish test assets relative to test project's output. --> <_ProjectsToPublish AdditionalProperties="%(_ProjectsToPublish.AdditionalProperties); PublishDir=$(PublishDir)%(RelativeFolder)" /> <!-- Do not build when publishing if SkipBuild requested. --> <_ProjectsToPublish Condition=" '%(SkipBuild)' == 'true' " AdditionalProperties="%(_ProjectsToPublish.AdditionalProperties);NoBuild=true" /> <!-- Otherwise, both Build and Publish test assets into folders relative to test project's output. Reset NoBuild because these projects aren't referenced anywhere else. --> <_ProjectsToPublish Condition=" '%(SkipBuild)' != 'true' " AdditionalProperties="%(_ProjectsToPublish.AdditionalProperties); NoBuild=false; OutputPath=$(OutputPath)%(RelativeFolder)" /> </ItemGroup> <!-- These are separate invocations to ensure Publish sees restored setup. Platform and PlatformTarget removals are to fix builds inside VS. --> <MSBuild Projects="@(_ProjectsToPublish->WithMetadataValue('SkipBuild', 'false'))" BuildInParallel="$(BuildInParallel)" Properties="MSBuildRestoreSessionId=$([System.Guid]::NewGuid())" RemoveProperties="Platform;PlatformTarget" Targets="Restore" /> <MSBuild Projects="@(_ProjectsToPublish)" Targets="Publish" RemoveProperties="Platform;PlatformTarget" /> </Target> </Project>