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,14 +1,31 @@
<Project>
<PropertyGroup>
<PublishWithAspNetCoreTargetManifest Condition="'$(PublishWithAspNetCoreTargetManifest)'==''">true</PublishWithAspNetCoreTargetManifest>
<ManifestRuntimeIdentifier Condition="'$(PublishWithAspNetCoreTargetManifest)'=='true' and '$(PublishableProject)'=='true'" >$(AspNetCoreTargetManifestRuntimeIdentifier)</ManifestRuntimeIdentifier>
</PropertyGroup>
<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>
<ManifestRuntimeIdentifier
Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))'
and '$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)'=='X86'">win7-x86</ManifestRuntimeIdentifier>
<ManifestRuntimeIdentifier
Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))'">osx.10.12-x64</ManifestRuntimeIdentifier>
<ManifestRuntimeIdentifier
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
Append the default ASP.NET Core runtime package store manifest during publish
*****************************************************************************
Error if manifest runtime identifier cannot be resolved
*******************************************************
-->
<Target
Name="PublishWithAspNetCoreTargetManifest"
@ -16,23 +33,6 @@ Append the default ASP.NET Core runtime package store manifest during publish
DependsOnTargets="PrepareForPublish"
Condition="'$(PublishWithAspNetCoreTargetManifest)'=='true' and '$(PublishableProject)'=='true'" >
<PropertyGroup>
<ManifestRuntimeIdentifier>$(AspNetCoreTargetManifestRuntimeIdentifier)</ManifestRuntimeIdentifier>
</PropertyGroup>
<PropertyGroup Condition="'$(AspNetCoreTargetManifestRuntimeIdentifier)'==''">
<ManifestRuntimeIdentifier
Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))'
and '$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)'=='X64'">win7-x64</ManifestRuntimeIdentifier>
<ManifestRuntimeIdentifier
Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))'
and '$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)'=='X86'">win7-x86</ManifestRuntimeIdentifier>
<ManifestRuntimeIdentifier
Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))'">osx.10.12-x64</ManifestRuntimeIdentifier>
<ManifestRuntimeIdentifier
Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">linux-x64</ManifestRuntimeIdentifier>
</PropertyGroup>
<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>