Use file globbing to resolve manifests

This commit is contained in:
John Luo 2017-06-05 17:11:49 -07:00
parent dd1baa9130
commit 7ac4bf14f2
2 changed files with 9 additions and 15 deletions

View File

@ -22,13 +22,4 @@
<Content Include="build\**\*.targets" PackagePath="%(Identity)" />
</ItemGroup>
<Target Name="UpdateManifestVersionNumbers" BeforeTargets="GenerateNuspec">
<PropertyGroup>
<ManifestTargetsFile>$(MSBuildThisFileDirectory)build\PublishWithAspNetCoreTargetManifest.targets</ManifestTargetsFile>
</PropertyGroup>
<Exec Command="powershell.exe -command &quot;(Get-Content $(ManifestTargetsFile)).replace('__MANIFEST_VERSION__','$(VersionPrefix)-$(VersionSuffix)') | Set-Content $(ManifestTargetsFile)&quot;" Condition="'$(OS)' == 'Windows_NT'"/>
<Exec Command="sed -i -e &quot;s/__MANIFEST_VERSION__/$(VersionPrefix)-$(VersionSuffix)/g&quot; $(ManifestTargetsFile)" Condition="'$(OS)' != 'Windows_NT'"/>
</Target>
</Project>

View File

@ -3,10 +3,6 @@
<PublishWithAspNetCoreTargetManifest Condition="'$(PublishWithAspNetCoreTargetManifest)'=='' and '$(RuntimeIdentifier)'=='' and '$(RuntimeIdentifiers)'=='' and '$(PublishableProject)'=='true'">true</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(PublishWithAspNetCoreTargetManifest)'=='true'">
<TargetManifestFiles>$(TargetManifestFiles);$(MSBuildThisFileDirectory)aspnetcore-store-__MANIFEST_VERSION__-win7-x64.xml;$(MSBuildThisFileDirectory)aspnetcore-store-__MANIFEST_VERSION__-win7-x86.xml;$(MSBuildThisFileDirectory)aspnetcore-store-__MANIFEST_VERSION__-osx-x64.xml;$(MSBuildThisFileDirectory)aspnetcore-store-__MANIFEST_VERSION__-linux-x64.xml</TargetManifestFiles>
</PropertyGroup>
<!--
******************************************************************************
Target: PublishWithAspNetCoreTargetManifest
@ -15,12 +11,19 @@ Error if PublishWithAspNetCoreTargetManifest is set to true for standalone app
-->
<Target
Name="PublishWithAspNetCoreTargetManifest"
BeforeTargets="Publish"
DependsOnTargets="PrepareForPublish"
AfterTargets="PrepareForPublish"
Condition="'$(PublishWithAspNetCoreTargetManifest)'=='true'" >
<Error
Text="PublishWithAspNetCoreTargetManifest cannot be set to true for standalone apps."
Condition="'$(RuntimeIdentifier)'!='' or '$(RuntimeIdentifiers)'!=''" />
<ItemGroup>
<AspNetCoreTargetManifestFiles Include="$(MSBuildThisFileDirectory)aspnetcore-store-*.xml"/>
</ItemGroup>
<PropertyGroup>
<TargetManifestFiles>$(TargetManifestFiles);@(AspNetCoreTargetManifestFiles)</TargetManifestFiles>
</PropertyGroup>
</Target>
</Project>