Generate bundled version props
This commit is contained in:
parent
4abb4d97a9
commit
a5051a0aff
2 changed files with 68 additions and 0 deletions
67
build/BundledVersions.targets
Normal file
67
build/BundledVersions.targets
Normal file
|
@ -0,0 +1,67 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<BundledVersionsIntermediateDirectory>$(IntermediateDirectory)/GeneratedMSBuildImports</BundledVersionsIntermediateDirectory>
|
||||
<BundledVersionsPropsFolder>15.0/Imports/Microsoft.Common.props/ImportBefore</BundledVersionsPropsFolder>
|
||||
<BundledVersionsPropsFileName>Microsoft.NETCoreSdk.BundledVersions.props</BundledVersionsPropsFileName>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="GenerateBundledVersionsProps"
|
||||
BeforeTargets="PublishMSBuildExtensions">
|
||||
|
||||
<!--
|
||||
The bundled version of Microsoft.NETCore.App is determined statically from DependencyVersions.props whereas the bundled version
|
||||
of NETStandard.Library is defined by what Microsoft.NETCore.App pulls in. This digs in to the package resolution items of
|
||||
of our build against Microsoft.NETCore.App to find the correct NETStandard.Library version
|
||||
-->
|
||||
<ItemGroup>
|
||||
<_NETStandardLibraryVersions Include="@(PackageDefinitions->'%(Version)')"
|
||||
Condition="%(PackageDefinitions.Name) == 'NetStandard.Library'" />
|
||||
</ItemGroup>
|
||||
|
||||
<Error Condition="@(_NETStandardLibraryVersions->Distinct()->Count()) != 1"
|
||||
Text="Failed to determine the NETStandard.Library version pulled in Microsoft.NETCore.App" />
|
||||
|
||||
<PropertyGroup>
|
||||
<_NETCoreAppPackageVersion>$(CLI_SharedFrameworkVersion)</_NETCoreAppPackageVersion>
|
||||
<_NETStandardPackageVersion>@(_NETStandardLibraryVersions->Distinct())</_NETStandardPackageVersion>
|
||||
|
||||
<!-- Use only major and minor in target framework version -->
|
||||
<_NETCoreAppTargetFrameworkVersion>$(_NETCoreAppPackageVersion.Split('.')[0]).$(_NETCoreAppPackageVersion.Split('.')[1])</_NETCoreAppTargetFrameworkVersion>
|
||||
<_NETStandardTargetFrameworkVersion>$(_NETStandardPackageVersion.Split('.')[0]).$(_NETStandardPackageVersion.Split('.')[1])</_NETStandardTargetFrameworkVersion>
|
||||
|
||||
<BundledVersionsPropsContent>
|
||||
<![CDATA[
|
||||
<!--
|
||||
***********************************************************************************************
|
||||
$(BundledVersionsPropsFileName)
|
||||
|
||||
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
|
||||
created a backup copy. Incorrect changes to this file will make it
|
||||
impossible to load or build your projects from the command-line or the IDE.
|
||||
|
||||
Copyright (c) .NET Foundation. All rights reserved.
|
||||
***********************************************************************************************
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<BundledNETCoreAppTargetFrameworkVersion>$(_NETCoreAppTargetFrameworkVersion)</BundledNETCoreAppTargetFrameworkVersion>
|
||||
<BundledNETCoreAppPackageVersion>$(_NETCoreAppPackageVersion)</BundledNETCoreAppPackageVersion>
|
||||
<BundledNETStandardTargetFrameworkVersion>$(_NETStandardTargetFrameworkVersion)</BundledNETStandardTargetFrameworkVersion>
|
||||
<BundledNETStandardPackageVersion>$(_NETStandardPackageVersion)</BundledNETStandardPackageVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
]]>
|
||||
</BundledVersionsPropsContent>
|
||||
</PropertyGroup>
|
||||
|
||||
<MakeDir Directories="$(BundledVersionsIntermediateDirectory)/$(BundledVersionsPropsFolder)" />
|
||||
<WriteLinesToFile File="$(BundledVersionsIntermediateDirectory)/$(BundledVersionsPropsFolder)/$(BundledVersionsPropsFileName)"
|
||||
Lines="$(BundledVersionsPropsContent)"
|
||||
Overwrite="true" />
|
||||
|
||||
<!-- MSBuildExtensionsContent destination is driven by %(RecursiveDir), which is why we glob here. -->
|
||||
<ItemGroup>
|
||||
<MSBuildExtensionsContent Include="$(BundledVersionsIntermediateDirectory)/**/$(BundledVersionsPropsFileName)" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
</Project>
|
|
@ -2,6 +2,7 @@
|
|||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.tasks" />
|
||||
<Import Project="$(RepoRoot)/build/compile/LzmaArchive.targets" />
|
||||
<Import Project="$(RepoRoot)/build/BundledVersions.targets" />
|
||||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>$(CliVersionPrefix)</VersionPrefix>
|
||||
|
|
Loading…
Reference in a new issue