Microsoft.AspNetCore.App.Ref.csproj 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <Project>
  2. <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
  3. <PropertyGroup>
  4. <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
  5. <IsShippingPackage>true</IsShippingPackage>
  6. <IsPackable>true</IsPackable>
  7. <IsPackable Condition="'$(IsTargetingPackBuilding)' == 'false'">false</IsPackable>
  8. <PackageId>$(TargetingPackName)</PackageId>
  9. <VersionPrefix>$(TargetingPackVersionPrefix)</VersionPrefix>
  10. <PackageDescription>Provides a default set of APIs for building an ASP.NET Core application. Contains reference assemblies, documentation, and other design-time assets.
  11. This package is an internal implementation of the .NET Core SDK and is not meant to be used as a normal PackageReference.</PackageDescription>
  12. <PackageTags>aspnetcore;targeting-pack</PackageTags>
  13. <SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
  14. <PackageType>DotnetPlatform</PackageType>
  15. <RefAssemblyPackagePath>ref/$(TargetFramework)/</RefAssemblyPackagePath>
  16. <!-- There are no symbols for reference assemblies. -->
  17. <IncludeSymbols>false</IncludeSymbols>
  18. <!-- The project representing the shared framework doesn't produce a .NET assembly or symbols. -->
  19. <DebugType>none</DebugType>
  20. <IncludeBuildOutput>false</IncludeBuildOutput>
  21. <CopyBuildOutputToPublishDirectory>false</CopyBuildOutputToPublishDirectory>
  22. <CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
  23. <CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
  24. <GenerateDependencyFile>false</GenerateDependencyFile>
  25. <!-- This project should not be referenced via the `<Reference>` impementation. -->
  26. <IsProjectReferenceProvider>false</IsProjectReferenceProvider>
  27. <PackageConflictManifestFileName>PackageOverrides.txt</PackageConflictManifestFileName>
  28. <!-- Reference implementation assemblies in addition to ref assemblies to get xml docs -->
  29. <ReferenceImplementationAssemblies>true</ReferenceImplementationAssemblies>
  30. </PropertyGroup>
  31. <ItemGroup>
  32. <!-- Note: do not add _TransitiveExternalAspNetCoreAppReference to this list. This is intentionally not listed as a direct package reference. -->
  33. <Reference Include="@(AspNetCoreAppReference);@(AspNetCoreAppReferenceAndPackage);@(ExternalAspNetCoreAppReference)" />
  34. <Reference Include="Microsoft.Internal.Extensions.Refs" Version="$(MicrosoftInternalExtensionsRefsPackageVersion)" IncludeAssets="Build" />
  35. <!-- Enforce build order. Targeting pack needs to bundle information about the runtime. -->
  36. <ProjectReference Include="..\src\Microsoft.AspNetCore.App.Runtime.csproj">
  37. <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
  38. <SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
  39. </ProjectReference>
  40. </ItemGroup>
  41. <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
  42. <PropertyGroup>
  43. <TargetingPackSubPath>packs\Microsoft.AspNetCore.App.Ref\$(PackageVersion)\</TargetingPackSubPath>
  44. <LayoutTargetDir>$(TargetingPackLayoutRoot)$(TargetingPackSubPath)</LayoutTargetDir>
  45. <LocalInstallationOutputPath>$(LocalDotNetRoot)$(TargetingPackSubPath)</LocalInstallationOutputPath>
  46. <ArchiveOutputFileName Condition="'$(TargetRuntimeIdentifier)' == 'win-x64'">aspnetcore-targeting-pack-$(PackageVersion).zip</ArchiveOutputFileName>
  47. <ArchiveOutputFileName Condition="'$(TargetRuntimeIdentifier)' == 'linux-x64'">aspnetcore-targeting-pack-$(PackageVersion).tar.gz</ArchiveOutputFileName>
  48. <ArchiveOutputPath>$(InstallersOutputPath)$(ArchiveOutputFileName)</ArchiveOutputPath>
  49. </PropertyGroup>
  50. <PropertyGroup>
  51. <!-- If this project won't produce a package, don't bother building anything. -->
  52. <BuildDependsOn Condition="'$(IsTargetingPackBuilding)' != 'false'">
  53. $(BuildDependsOn);
  54. GeneratePackageConflictManifest;
  55. _ResolveTargetingPackContent;
  56. _BatchCopyToLayoutTargetDir;
  57. _InstallTargetingPackIntoLocalDotNet;
  58. _CreateTargetingPackArchive;
  59. </BuildDependsOn>
  60. </PropertyGroup>
  61. <!-- Override the default MSBuild targets so that nothing is returned from the project since it represents a collection of assemblies. -->
  62. <Target Name="GetTargetPath" />
  63. <Target Name="Build" DependsOnTargets="$(BuildDependsOn)" />
  64. <!-- This project doesn't compile anything. -->
  65. <Target Name="CoreCompile" />
  66. <!-- Completely disable default targets for copying to output. -->
  67. <Target Name="CopyFilesToOutputDirectory" />
  68. <!-- This target finds the reference assemblies. -->
  69. <Target Name="_ResolveTargetingPackContent"
  70. BeforeTargets="_GetPackageFiles"
  71. DependsOnTargets="ResolveReferences;FindReferenceAssembliesForReferences">
  72. <ItemGroup>
  73. <_AvailableExtensionsRefAssemblies Include="$(MicrosoftInternalExtensionsRefsPath)\*.dll" />
  74. </ItemGroup>
  75. <JoinItems Left="@(ReferencePathWithRefAssemblies)" Right="@(_AvailableExtensionsRefAssemblies)" LeftKey="Filename" RightKey="Filename" ItemSpecToUse="Left">
  76. <Output TaskParameter="JoinResult" ItemName="_SelectedExtensionsRefAssemblies" />
  77. </JoinItems>
  78. <ItemGroup>
  79. <AspNetCoreReferenceAssemblyPath
  80. Include="@(ReferencePathWithRefAssemblies)"
  81. Exclude="
  82. @(_SelectedExtensionsRefAssemblies);
  83. @(ReferencePathWithRefAssemblies->WithMetadataValue('NuGetPackageId', 'Microsoft.NETCore.App'));
  84. @(ReferencePathWithRefAssemblies->WithMetadataValue('ReferenceGrouping', 'Microsoft.NETCore.App'));" />
  85. <AspNetCoreReferenceAssemblyPath
  86. Include="@(_SelectedExtensionsRefAssemblies->'$(MicrosoftInternalExtensionsRefsPath)%(FileName)%(Extension)')" />
  87. <AspNetCoreReferenceDocXml Include="@(_ResolvedProjectReferencePaths->WithMetadataValue('IsReferenceAssembly', 'false')->'%(RootDir)%(Directory)%(FileName).xml')" />
  88. <AspNetCoreReferenceDocXml Include="@(_SelectedExtensionsRefAssemblies->'$(MicrosoftInternalExtensionsRefsPath)%(FileName).xml')" />
  89. <RefPackContent Include="@(AspNetCoreReferenceAssemblyPath)" PackagePath="$(RefAssemblyPackagePath)" />
  90. <RefPackContent Include="@(AspNetCoreReferenceDocXml)" PackagePath="$(RefAssemblyPackagePath)" />
  91. <RefPackContent Include="$(TargetDir)$(PackageConflictManifestFileName)" PackagePath="$(ManifestsPackagePath)" />
  92. <RefPackContent Include="$(PlatformManifestOutputPath)" PackagePath="$(ManifestsPackagePath)" />
  93. <_PackageFiles Include="@(RefPackContent)" />
  94. </ItemGroup>
  95. </Target>
  96. <Target Name="GeneratePackageConflictManifest"
  97. DependsOnTargets="ResolveReferences"
  98. Inputs="$(MSBuildAllProjects)"
  99. Outputs="$(TargetDir)$(PackageConflictManifestFileName)">
  100. <ItemGroup>
  101. <_AspNetCoreAppPackageOverrides Include="@(ReferencePath->'%(NuGetPackageId)|%(NuGetPackageVersion)')" Condition=" '%(ReferencePath.NuGetPackageId)' != 'Microsoft.NETCore.App' AND '%(ReferencePath.NuGetSourceType)' == 'Package' " />
  102. <_AspNetCoreAppPackageOverrides Include="@(ReferencePath->'%(FileName)|$(SharedFxVersion)')" Condition=" '%(ReferencePath.ReferenceSourceTarget)' == 'ProjectReference' " />
  103. </ItemGroup>
  104. <WriteLinesToFile
  105. Lines="@(_AspNetCoreAppPackageOverrides)"
  106. File="$(TargetDir)$(PackageConflictManifestFileName)"
  107. Overwrite="true" />
  108. </Target>
  109. <!-- Written to take advantage of target batching in MSBuild. -->
  110. <Target Name="_BatchCopyToLayoutTargetDir"
  111. DependsOnTargets="_ResolveTargetingPackContent"
  112. Inputs="@(RefPackContent)"
  113. Outputs="@(RefPackContent->'$(LayoutTargetDir)%(PackagePath)%(FileName)%(Extension)')">
  114. <Copy SourceFiles="@(RefPackContent)"
  115. DestinationFiles="@(RefPackContent->'$(LayoutTargetDir)%(PackagePath)%(FileName)%(Extension)')"
  116. UseHardlinksIfPossible="true" />
  117. <Message Importance="High" Text="$(MSBuildProjectName) -> $(LayoutTargetDir)" />
  118. </Target>
  119. <ItemGroup>
  120. <CreateDirectory Include="$(LocalInstallationOutputPath)" />
  121. </ItemGroup>
  122. <!-- Workaround https://github.com/dotnet/sdk/issues/2910 by copying targeting pack into local installation. -->
  123. <Target Name="_InstallTargetingPackIntoLocalDotNet"
  124. DependsOnTargets="_ResolveTargetingPackContent"
  125. Inputs="@(RefPackContent)"
  126. Outputs="@(RefPackContent->'$(LocalInstallationOutputPath)%(PackagePath)%(FileName)%(Extension)')">
  127. <Copy SourceFiles="@(RefPackContent)"
  128. DestinationFiles="@(RefPackContent->'$(LocalInstallationOutputPath)%(PackagePath)%(FileName)%(Extension)')"
  129. UseHardlinksIfPossible="true" />
  130. <Message Importance="High" Text="$(MSBuildProjectName) -> $(LocalInstallationOutputPath)" />
  131. </Target>
  132. <Target Name="_CreateTargetingPackArchive"
  133. Inputs="@(RefPackContent)"
  134. Outputs="$(ArchiveOutputPath)"
  135. Condition="'$(IsPackable)' == 'true'">
  136. <ZipDirectory
  137. SourceDirectory="$(TargetingPackLayoutRoot)"
  138. DestinationFile="$(ArchiveOutputPath)"
  139. Overwrite="true"
  140. Condition="'$(TargetRuntimeIdentifier)' == 'win-x64'" />
  141. <Exec
  142. Command="tar -czf $(ArchiveOutputPath) ."
  143. WorkingDirectory="$(TargetingPackLayoutRoot)"
  144. Condition="'$(TargetRuntimeIdentifier)' == 'linux-x64'" />
  145. <Message Importance="High" Text="$(MSBuildProjectName) -> $(ArchiveOutputPath)" />
  146. </Target>
  147. </Project>