Set TargetManifestFiles in PropertyGroup

This commit is contained in:
John Luo 2017-04-25 03:04:32 -07:00
parent b5125caa44
commit 98b1945d65
1 changed files with 21 additions and 25 deletions

View File

@ -1,26 +1,10 @@
<Project>
<PropertyGroup>
<PublishWithAspNetCoreTargetManifest Condition="'$(PublishWithAspNetCoreTargetManifest)'==''">true</PublishWithAspNetCoreTargetManifest>
<ManifestRuntimeIdentifier Condition="'$(PublishWithAspNetCoreTargetManifest)'=='true' and '$(PublishableProject)'=='true'" >$(AspNetCoreTargetManifestRuntimeIdentifier)</ManifestRuntimeIdentifier>
</PropertyGroup>
<!--
*****************************************************************************
Target: PublishWithAspNetCoreTargetManifest
Append the default ASP.NET Core runtime package store manifest during publish
*****************************************************************************
-->
<Target
Name="PublishWithAspNetCoreTargetManifest"
BeforeTargets="Publish"
DependsOnTargets="PrepareForPublish"
Condition="'$(PublishWithAspNetCoreTargetManifest)'=='true' and '$(PublishableProject)'=='true'" >
<PropertyGroup>
<ManifestRuntimeIdentifier>$(AspNetCoreTargetManifestRuntimeIdentifier)</ManifestRuntimeIdentifier>
</PropertyGroup>
<PropertyGroup Condition="'$(AspNetCoreTargetManifestRuntimeIdentifier)'==''">
<PropertyGroup Condition="'$(PublishWithAspNetCoreTargetManifest)'=='true' and '$(PublishableProject)'=='true' and '$(ManifestRuntimeIdentifier)'==''">
<ManifestRuntimeIdentifier
Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))'
and '$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)'=='X64'">win7-x64</ManifestRuntimeIdentifier>
@ -33,6 +17,22 @@ Append the default ASP.NET Core runtime package store manifest during publish
Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">linux-x64</ManifestRuntimeIdentifier>
</PropertyGroup>
<PropertyGroup Condition="'$(PublishWithAspNetCoreTargetManifest)'=='true' and '$(PublishableProject)'=='true'">
<TargetManifestFiles>$(TargetManifestFiles);$(MSBuildThisFileDirectory)manifest.$(ManifestRuntimeIdentifier).xml</TargetManifestFiles>
</PropertyGroup>
<!--
*******************************************************
Target: PublishWithAspNetCoreTargetManifest
Error if manifest runtime identifier cannot be resolved
*******************************************************
-->
<Target
Name="PublishWithAspNetCoreTargetManifest"
BeforeTargets="Publish"
DependsOnTargets="PrepareForPublish"
Condition="'$(PublishWithAspNetCoreTargetManifest)'=='true' and '$(PublishableProject)'=='true'" >
<Error
Text="Could not resolve manifest runtime identifier. Please specify the the runtime identifier via the AspNetCoreTargetManifestRuntimeIdentifier property."
Condition="'$(ManifestRuntimeIdentifier)'==''" />
@ -40,9 +40,5 @@ Append the default ASP.NET Core runtime package store manifest during publish
<Message
Text="Appending default ASP.NET Core runtime package store manifest for use during publish based for the runtime $(ManifestRuntimeIdentifier)."
Importance="low" />
<PropertyGroup>
<TargetManifest>$(TargetManifest);$(MSBuildThisFileDirectory)manifest.$(ManifestRuntimeIdentifier).xml</TargetManifest>
</PropertyGroup>
</Target>
</Project>