* Always include CoreCLR in NCA versions txt file
This makes it appear where it's expected. It shouldn't be a problem that it now appears in a package that doesn't truly use CoreCLR. If anything, it makes it easier to find, which could be useful.
* Fix M.NETCore.App.Internal build file differences
Fix GetDependencyDataFileInclusionDefaults to actually affect the condition.
Use a template for the props file and have each pkgproj fill it, so that each pkgproj can configure it. Use non-".Internal" name to refer to platform manifest to keep that filename consistent.
* Fix latest commit usage
* Fix names of deps.json and runtimeconfig.json
* Remove Packaging tools package from sfx deps json
* Add comment about props file placeholders
Commit migrated from https://github.com/dotnet/core-setup/commit/
32d0950119e1537f136efc5ee5bb13b800f4bda0
<SkipIndexCheck>true</SkipIndexCheck>
</PropertyGroup>
- <ItemGroup>
- <PackageReference Include="Microsoft.DotNet.Build.Tasks.Packaging" Version="$(MicrosoftDotNetBuildTasksPackagingPackageVersion)" />
- </ItemGroup>
-
<PropertyGroup>
<PackagingToolsDir>$(MSBuildThisFileDirectory)packaging-tools/</PackagingToolsDir>
--- /dev/null
+<Project>
+ <!--
+ Shared properties specific to dependency projects (depproj).
+ -->
+
+ <ItemGroup>
+ <PackageReference Include="Microsoft.DotNet.Build.Tasks.Packaging" Version="$(MicrosoftDotNetBuildTasksPackagingPackageVersion)" />
+ </ItemGroup>
+
+</Project>
<!-- Creates the *.versions.txt file describing where data in this package came from. -->
<Target Name="GenerateHashVersionsFile"
- DependsOnTargets="GetDependencyVersionFiles"
+ DependsOnTargets="
+ GetDependencyVersionFiles;
+ GetLatestCommit"
Condition="'$(FrameworkPackageName)' != ''">
<Error
Condition="'@(DependencyVersionFile)' != '' AND !Exists('%(DependencyVersionFile.Identity)')"
<Target Name="SetupGenerateFileVersionProps"
Condition="'$(FrameworkPackageName)' != ''">
<PropertyGroup>
- <PropsFile>$(IntermediateOutputPath)$(MSBuildProjectName).props</PropsFile>
- <PlatformManifestFile>$(IntermediateOutputPath)$(MSBuildProjectName).PlatformManifest.txt</PlatformManifestFile>
+ <PropsFile>$(IntermediateOutputPath)$(FrameworkPackageName).props</PropsFile>
+ <PlatformManifestFile>$(IntermediateOutputPath)$(FrameworkPackageName).PlatformManifest.txt</PlatformManifestFile>
</PropertyGroup>
<ItemGroup>
<PermitDllAndExeFilesLackingFileVersion>true</PermitDllAndExeFilesLackingFileVersion>
</PropertyGroup>
+ <!--
+ Generate the props file using placeholders for __PackageId__ and __PreferredPackages__. Each
+ pkgproj that depends on this depproj needs to fill it in with unique info. The depproj's copy
+ of the props file is considered a template. The tokens use underscores because the PackageId
+ string needs to be valid XML.
+ -->
<GenerateFileVersionProps Files="@(SharedFrameworkRuntimeFiles)"
- PackageId="$(FrameworkPackageName)"
+ PackageId="__PackageId__"
PackageVersion="$(Version)"
PlatformManifestFile="$(PlatformManifestFile)"
PropsFile="$(PropsFile)"
- PreferredPackages="$(Id);@(RuntimeDependency)"
+ PreferredPackages="__PreferredPackages__"
PermitDllAndExeFilesLackingFileVersion="$(PermitDllAndExeFilesLackingFileVersion)" />
</Target>
--- /dev/null
+<Project>
+ <!--
+ Shared properties specific to packaging projects (pkgproj).
+ -->
+
+ <ItemGroup>
+ <PackageReference Include="Microsoft.DotNet.Build.Tasks.Packaging" Version="$(MicrosoftDotNetBuildTasksPackagingPackageVersion)" />
+ </ItemGroup>
+
+</Project>
<TargetFramework>$(NETCoreAppFramework)</TargetFramework>
<PackageId>unused</PackageId>
- <ProjectDepsFileName>$(SharedFrameworkName).deps.json</ProjectDepsFileName>
-
<!--
When blank, MicrosoftNETPlatformLibrary defaults to Microsoft.NETCore.App. This property
causes the SDK to trim dependencies when publishing a framework-dependent app. We want to be
</PropertyGroup>
<WriteLinesToFile
- File="$(PublishDir)$(MSBuildProjectName).runtimeconfig.json"
+ File="$(PublishDir)$(SfxIdentity).runtimeconfig.json"
Lines="$(_runtimeConfigContent)"
Overwrite="true" />
</Target>
<Target Name="GenerateVersionFile"
- DependsOnTargets="GetPackageReference"
+ DependsOnTargets="
+ GetPackageReference;
+ GetLatestCommitFromPkgproj"
BeforeTargets="Publish">
<!-- Generate .version file -->
<ItemGroup>
</Target>
<!--
+ This project doesn't have access to SourceLink because Restore happened in the same MSBuild
+ context and the generated NuGet props haven't applied. Call into a pkgproj to get this info.
+ -->
+ <Target Name="GetLatestCommitFromPkgproj">
+ <PropertyGroup>
+ <OnePkgProjectReference>%(PkgProjectReference.Identity)</OnePkgProjectReference>
+ </PropertyGroup>
+
+ <MSBuild Projects="$(OnePkgProjectReference)" Targets="ReturnLatestCommit">
+ <Output TaskParameter="TargetOutputs" PropertyName="LatestCommit" />
+ </MSBuild>
+ </Target>
+
+ <!--
NETCoreApp (and only NETCoreApp) carries the host and host resolver in the shared framework,
which lives outside the shared/ directory. These were included in publish through package
references and the files must be moved.
<Copy SourceFiles="@(SharedFrameworkSymbols)" DestinationFolder="$(SharedFrameworkPublishSymbolsDir)" />
</Target>
+ <Target Name="FixDepsJsonFileName"
+ AfterTargets="Publish">
+ <PropertyGroup>
+ <SharedFrameworkDepsOriginFile>$(PublishDir)$(ProjectDepsFileName)</SharedFrameworkDepsOriginFile>
+ <SharedFrameworkDepsDestinationFile>$(PublishDir)$(SfxIdentity).deps.json</SharedFrameworkDepsDestinationFile>
+ </PropertyGroup>
+
+ <Move
+ SourceFiles="$(SharedFrameworkDepsOriginFile)"
+ DestinationFiles="$(SharedFrameworkDepsDestinationFile)" />
+ </Target>
+
<Target Name="GenerateRuntimeGraph"
Condition="'$(GenerateRuntimeGraph)' == 'true'"
+ DependsOnTargets="FixDepsJsonFileName"
AfterTargets="Publish">
<PropertyGroup>
- <SharedFrameworkDepsFile>$(PublishDir)$(ProjectDepsFileName)</SharedFrameworkDepsFile>
<RuntimeGraphGeneratorRuntime Condition="'$(OSGroup)'=='Windows_NT'">win</RuntimeGraphGeneratorRuntime>
<RuntimeGraphGeneratorRuntime Condition="'$(OSGroup)'=='OSX'">osx</RuntimeGraphGeneratorRuntime>
<RuntimeGraphGeneratorRuntime Condition="'$(OSGroup)'=='FreeBSD'">freebsd</RuntimeGraphGeneratorRuntime>
</ItemGroup>
<ProcessSharedFrameworkDeps AssetsFilePath="$(ProjectAssetsFile)"
- DepsFilePath="$(SharedFrameworkDepsFile)"
+ DepsFilePath="$(SharedFrameworkDepsDestinationFile)"
PackagesToRemove="@(TrimPkgsFromDeps)"
Runtime="$(RuntimeGraphGeneratorRuntime)"
BuildTasksAssemblyPath="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll" />
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="framework.dependency.props" Condition="'$(MSBuildProjectExtension)' == '.depproj'" />
+ <Import Project="framework.packaging.props" Condition="'$(MSBuildProjectExtension)' == '.pkgproj'" />
<Import Project="framework.sharedfx.props" Condition="'$(MSBuildProjectExtension)' == '.sfxproj'" />
<PropertyGroup>
</PropertyGroup>
</Target>
+ <Target Name="GetLatestCommit"
+ DependsOnTargets="InitializeSourceControlInformationFromSourceControlManager">
+ <PropertyGroup>
+ <LatestCommit Condition="'$(LatestCommit)' == ''">$(SourceRevisionId)</LatestCommit>
+ </PropertyGroup>
+ </Target>
+
+ <Target Name="ReturnLatestCommit"
+ DependsOnTargets="GetLatestCommit"
+ Returns="$(LatestCommit)" />
+
+ <!-- Override pkgproj tool target to provide commit info. -->
+ <Target Name="GetSyncInfo"
+ DependsOnTargets="GetLatestCommit">
+ <ItemGroup>
+ <SyncInfoLines Include="$(LatestCommit)" />
+ </ItemGroup>
+ </Target>
+
<!--
By default, shared frameworks are generated based on the package. This can be overridden by the
project, and in the future, the runtime pack is likely to be used to assemble the sfx.
<Target Name="GetDependencyDataFileInclusionDefaults">
<PropertyGroup Condition="'$(BuildTargetPath)' != ''">
<FileVersionPropsTargetPath Condition="'$(FileVersionPropsTargetPath)' == ''">$(BuildTargetPath)$(Id).props</FileVersionPropsTargetPath>
- <PlatformManifestTargetPath Condition="'$(PlatformManifestTargetPath)' == ''">$(BuildTargetPath)$(Id).props</PlatformManifestTargetPath>
+ <PlatformManifestTargetPath Condition="'$(PlatformManifestTargetPath)' == ''">$(BuildTargetPath)$(Id.Replace('.Internal', '')).PlatformManifest.txt</PlatformManifestTargetPath>
</PropertyGroup>
</Target>
<Target Name="IncludeFileVersionPropsFile"
DependsOnTargets="GetDepprojDependencyDataFiles;GetDependencyDataFileInclusionDefaults"
- BeforeTargets="GetFiles"
- Condition="'$(PackageTargetRuntime)' == '' AND '$(FileVersionPropsTargetPath)' != ''">
- <ItemGroup>
+ BeforeTargets="GetFiles">
+ <!-- Create a copy with some per-pkgproj templates replaced. -->
+ <PropertyGroup>
+ <_propsFileTemplateFile Condition="'%(_depprojDataFile.PropsFile)' == 'true'">%(_depprojDataFile.Identity)</_propsFileTemplateFile>
+ </PropertyGroup>
+
+ <PropertyGroup Condition="Exists('$(_propsFileTemplateFile)')">
+ <_runtimeDependencyItems>@(RuntimeDependency)</_runtimeDependencyItems>
+ <_filledPropsFileContent>$([System.IO.File]::ReadAllText('$(_propsFileTemplateFile)')
+ .Replace("__PackageId__", "$(Id.Replace('.', '_'))")
+ .Replace("__PreferredPackages__", "$(Id);$(_runtimeDependencyItems)"))
+ </_filledPropsFileContent>
+
+ <_filledPropsFile>$(IntermediateOutputPath)$(MSBuildProjectName).props</_filledPropsFile>
+ </PropertyGroup>
+
+ <WriteLinesToFile
+ Condition="'$(_filledPropsFile)' != ''"
+ File="$(_filledPropsFile)"
+ Lines="$(_filledPropsFileContent)"
+ Overwrite="true" />
+
+ <ItemGroup Condition="'$(PackageTargetRuntime)' == '' AND '$(FileVersionPropsTargetPath)' != ''">
<File
- Include="@(_depprojDataFile)"
- Condition="'%(_depprojDataFile.PropsFile)' == 'true'"
+ Include="$(_filledPropsFile)"
TargetPath="$(FileVersionPropsTargetPath)" />
</ItemGroup>
</Target>
<Target Name="IncludePlatformManifestFile"
DependsOnTargets="GetDepprojDependencyDataFiles;GetDependencyDataFileInclusionDefaults"
- BeforeTargets="GetFiles"
- Condition="'$(PackageTargetRuntime)' == '' AND '$(PlatformManifestTargetPath)' != ''">
- <ItemGroup>
+ BeforeTargets="GetFiles">
+ <ItemGroup Condition="'$(PackageTargetRuntime)' == '' AND '$(PlatformManifestTargetPath)' != ''">
<File
Include="@(_depprojDataFile)"
Condition="'%(_depprojDataFile.PlatformManifestFile)' == 'true'"
Name="corefx" />
<_coreClrVersionFile
Include="$(_runtimePackageDir)version.txt"
- Condition="'$(PackageTargetRuntime)' != ''"
Name="coreclr" />
<DependencyVersionFile Include="@(_coreFxVersionFile);@(_coreClrVersionFile)" />
Text="Failed to locate corefx version.txt file." />
<Error
- Condition="'@(_coreClrVersionFile)' == '' AND '$(PackageTargetRuntime)' != ''"
+ Condition="'@(_coreClrVersionFile)' == ''"
Text="Failed to locate coreclr version.txt file." />
</Target>