<Project>
<!-- Publish only: ordinary builds and test builds must not recursively publish another app. -->
<PropertyGroup>
<IncludeIndexingService Condition="'$(IncludeIndexingService)' == ''">true</IncludeIndexingService>
<IndexingServiceRuntimeIdentifier Condition="'$(RuntimeIdentifier)' != ''">$(RuntimeIdentifier)</IndexingServiceRuntimeIdentifier>
<IndexingServiceRuntimeIdentifier Condition="'$(IndexingServiceRuntimeIdentifier)' == ''">win-x64</IndexingServiceRuntimeIdentifier>
</PropertyGroup>
<Target Name="PublishIndexingServiceBundle" AfterTargets="Publish"
Condition="'$(IncludeIndexingService)' == 'true' and '$(IsCrossTargetingBuild)' != 'true'">
<PropertyGroup>
<_IndexingServiceClientPublishDirectory>$([System.IO.Path]::GetFullPath('$(PublishDir)', '$(MSBuildProjectDirectory)'))</_IndexingServiceClientPublishDirectory>
<_IndexingServicePublishDirectory>$([System.IO.Path]::Combine('$(_IndexingServiceClientPublishDirectory)', 'IndexingService'))\</_IndexingServicePublishDirectory>
</PropertyGroup>
<!-- RemoveProperties is applied after Properties. In particular, do not remove PublishDir:
doing so silently publishes the child to its default folder instead of the bundle. -->
<MSBuild Projects="$(MSBuildThisFileDirectory)..\XFEToolBox.Indexing.Service\XFEToolBox.Indexing.Service.csproj"
Targets="Restore;Publish" BuildInParallel="false"
RemoveProperties="PublishProfile;PublishProfileFullPath;TargetFramework;OutputPath;OutDir;PublishUrl;ApplicationManifest;UseWPF;UseWindowsForms;PublishAot"
Properties="Configuration=$(Configuration);RuntimeIdentifier=$(IndexingServiceRuntimeIdentifier);SelfContained=true;PublishSingleFile=false;PublishReadyToRun=$(PublishReadyToRun);PublishDir=$(_IndexingServicePublishDirectory);IncludeIndexingService=false" />
<Error Condition="!Exists('$(_IndexingServicePublishDirectory)XFEToolBox.Indexing.Service.exe') or !Exists('$(_IndexingServicePublishDirectory)XFEToolBox.Indexing.Service.runtimeconfig.json') or !Exists('$(_IndexingServicePublishDirectory)XFEToolBox.Indexing.Service.deps.json') or !Exists('$(_IndexingServicePublishDirectory)coreclr.dll')"
Text="The self-contained indexing service bundle was not published to $(_IndexingServicePublishDirectory)." />
</Target>
</Project>
<Project>
<!-- Publish only: ordinary builds and test builds must not recursively publish another app. -->
<PropertyGroup>
<IncludeIndexingService Condition="'$(IncludeIndexingService)' == ''">true</IncludeIndexingService>
<IndexingServiceRuntimeIdentifier Condition="'$(RuntimeIdentifier)' != ''">$(RuntimeIdentifier)</IndexingServiceRuntimeIdentifier>
<IndexingServiceRuntimeIdentifier Condition="'$(IndexingServiceRuntimeIdentifier)' == ''">win-x64</IndexingServiceRuntimeIdentifier>
</PropertyGroup>
<Target Name="PublishIndexingServiceBundle" AfterTargets="Publish"
Condition="'$(IncludeIndexingService)' == 'true' and '$(IsCrossTargetingBuild)' != 'true'">
<PropertyGroup>
<_IndexingServiceClientPublishDirectory>$([System.IO.Path]::GetFullPath('$(PublishDir)', '$(MSBuildProjectDirectory)'))</_IndexingServiceClientPublishDirectory>
<_IndexingServicePublishDirectory>$([System.IO.Path]::Combine('$(_IndexingServiceClientPublishDirectory)', 'IndexingService'))\</_IndexingServicePublishDirectory>
</PropertyGroup>
<!-- RemoveProperties is applied after Properties. In particular, do not remove PublishDir:
doing so silently publishes the child to its default folder instead of the bundle. -->
<MSBuild Projects="$(MSBuildThisFileDirectory)..\XFEToolBox.Indexing.Service\XFEToolBox.Indexing.Service.csproj"
Targets="Restore;Publish" BuildInParallel="false"
RemoveProperties="PublishProfile;PublishProfileFullPath;TargetFramework;OutputPath;OutDir;PublishUrl;ApplicationManifest;UseWPF;UseWindowsForms;PublishAot"
Properties="Configuration=$(Configuration);RuntimeIdentifier=$(IndexingServiceRuntimeIdentifier);SelfContained=true;PublishSingleFile=false;PublishReadyToRun=$(PublishReadyToRun);PublishDir=$(_IndexingServicePublishDirectory);IncludeIndexingService=false" />
<Error Condition="!Exists('$(_IndexingServicePublishDirectory)XFEToolBox.Indexing.Service.exe') or !Exists('$(_IndexingServicePublishDirectory)XFEToolBox.Indexing.Service.runtimeconfig.json') or !Exists('$(_IndexingServicePublishDirectory)XFEToolBox.Indexing.Service.deps.json') or !Exists('$(_IndexingServicePublishDirectory)coreclr.dll')"
Text="The self-contained indexing service bundle was not published to $(_IndexingServicePublishDirectory)." />
</Target>
</Project>