Add target to set default target manifest

This commit is contained in:
John Luo 2017-04-17 15:13:02 -07:00
parent ce365799a6
commit 87c513b0d8
3 changed files with 57 additions and 1 deletions

View File

@ -146,4 +146,9 @@
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="$(AspNetCoreVersion)" PrivateAssets="None" Condition="'$(BUILD_PACKAGE_CACHE)' == 'true'" />
</ItemGroup>
</Project>
<ItemGroup>
<Content Include="build\**\*.xml" Package="true" />
<Content Include="build\**\*.targets" Package="true" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,48 @@
<Project>
<PropertyGroup>
<PublishWithAspNetCoreTargetManifest Condition="'$(PublishWithAspNetCoreTargetManifest)'==''">true</PublishWithAspNetCoreTargetManifest>
</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)'==''">
<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)'==''" />
<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>

View File

@ -0,0 +1,3 @@
<Project>
<Import Project="$(MSBuildThisFileDirectory)..\PublishWithAspNetCoreTargetManifest.targets" />
</Project>