Microsoft.AspNetCore.App.Ref.csproj 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <Project>
  2. <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
  3. <PropertyGroup>
  4. <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
  5. <IsPackable>true</IsPackable>
  6. <IsPackable Condition="'$(IsTargetingPackBuilding)' == 'false'">false</IsPackable>
  7. <PackageId>$(TargetingPackName)</PackageId>
  8. <VersionPrefix>$(TargetingPackVersionPrefix)</VersionPrefix>
  9. <!-- This is a reference package and does not include any dependencies. -->
  10. <NoWarn>$(NoWarn);NU5128</NoWarn>
  11. <PackageDescription>Provides a default set of APIs for building an ASP.NET Core application. Contains reference assemblies, documentation, and other design-time assets.
  12. This package is an internal implementation of the .NET Core SDK and is not meant to be used as a normal PackageReference.</PackageDescription>
  13. <PackageTags>aspnetcore;targeting-pack</PackageTags>
  14. <SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
  15. <PackageType>DotnetPlatform</PackageType>
  16. <RefAssemblyPackagePath>ref/$(TargetFramework)/</RefAssemblyPackagePath>
  17. <!-- There are no symbols for reference assemblies. -->
  18. <IncludeSymbols>false</IncludeSymbols>
  19. <!-- The project representing the shared framework doesn't produce a .NET assembly or symbols. -->
  20. <DebugType>none</DebugType>
  21. <IncludeBuildOutput>false</IncludeBuildOutput>
  22. <CopyBuildOutputToPublishDirectory>false</CopyBuildOutputToPublishDirectory>
  23. <CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
  24. <CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
  25. <GenerateDependencyFile>false</GenerateDependencyFile>
  26. <!-- This project should not be referenced via the `<Reference>` implementation. -->
  27. <IsProjectReferenceProvider>false</IsProjectReferenceProvider>
  28. <PackageConflictManifestFileName>PackageOverrides.txt</PackageConflictManifestFileName>
  29. <!-- Reference implementation assemblies in addition to ref assemblies to get xml docs -->
  30. <ReferenceImplementationAssemblies>true</ReferenceImplementationAssemblies>
  31. <!--
  32. We are ignoring MSB3243 warnings since implementation and reference assemblies are versioned differently.
  33. We need both to compose the targeting pack with reference assemblies and xml docs.
  34. -->
  35. <MSBuildWarningsAsMessages>MSB3243</MSBuildWarningsAsMessages>
  36. <!-- We are ignoring NU5131 and NU5128 warnings since the dependency group should be kept empty. -->
  37. <NoWarn>$(NoWarn);NU5131;NU5128</NoWarn>
  38. <!-- Platform manifest data -->
  39. <FrameworkListFileName>FrameworkList.xml</FrameworkListFileName>
  40. <FrameworkListOutputPath>$(ArtifactsObjDir)$(FrameworkListFileName)</FrameworkListOutputPath>
  41. <!-- Platform manifest and package override metatdata -->
  42. <ReferencePackSharedFxVersion>$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).0</ReferencePackSharedFxVersion>
  43. <ReferencePackSharedFxVersion Condition="'$(VersionSuffix)' != ''">$(ReferencePackSharedFxVersion)-$(VersionSuffix)</ReferencePackSharedFxVersion>
  44. <ReferencePlatformManifestPath Condition="'$(IsServicingBuild)' != 'true'">$(PlatformManifestOutputPath)</ReferencePlatformManifestPath>
  45. <ReferencePlatformManifestPath Condition="'$(IsServicingBuild)' == 'true'">$(RepoRoot)eng\PlatformManifest.txt</ReferencePlatformManifestPath>
  46. </PropertyGroup>
  47. <ItemGroup>
  48. <!-- Note: do not add _TransitiveExternalAspNetCoreAppReference to this list. This is intentionally not listed as a direct package reference. -->
  49. <Reference Include="@(AspNetCoreAppReference);@(AspNetCoreAppReferenceAndPackage);@(ExternalAspNetCoreAppReference)" />
  50. <!-- Enforce build order. Targeting pack needs to bundle information about the runtime. -->
  51. <ProjectReference Include="..\src\Microsoft.AspNetCore.App.Runtime.csproj">
  52. <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
  53. <SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
  54. </ProjectReference>
  55. </ItemGroup>
  56. <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
  57. <PropertyGroup>
  58. <TargetingPackSubPath>packs\Microsoft.AspNetCore.App.Ref\$(PackageVersion)\</TargetingPackSubPath>
  59. <LayoutTargetDir>$(TargetingPackLayoutRoot)$(TargetingPackSubPath)</LayoutTargetDir>
  60. <LocalInstallationOutputPath>$(LocalDotNetRoot)$(TargetingPackSubPath)</LocalInstallationOutputPath>
  61. <ArchiveOutputFileName>aspnetcore-targeting-pack-$(PackageVersion)</ArchiveOutputFileName>
  62. <ZipArchiveOutputPath>$(InstallersOutputPath)$(ArchiveOutputFileName).zip</ZipArchiveOutputPath>
  63. <TarArchiveOutputPath>$(InstallersOutputPath)$(ArchiveOutputFileName).tar.gz</TarArchiveOutputPath>
  64. </PropertyGroup>
  65. <PropertyGroup>
  66. <!-- If this project won't produce a package, don't bother building anything. -->
  67. <BuildDependsOn Condition="'$(IsTargetingPackBuilding)' != 'false'">
  68. $(BuildDependsOn);
  69. _ResolveTargetingPackContent;
  70. GeneratePackageConflictManifest;
  71. IncludeFrameworkListFile;
  72. _BatchCopyToLayoutTargetDir;
  73. _InstallTargetingPackIntoLocalDotNet;
  74. _CreateTargetingPackArchive;
  75. </BuildDependsOn>
  76. <!-- No-op when in source build -->
  77. <BuildDependsOn Condition="'$(IsTargetingPackBuilding)' == 'false'"/>
  78. </PropertyGroup>
  79. <!-- Override the default MSBuild targets so that nothing is returned from the project since it represents a collection of assemblies. -->
  80. <Target Name="GetTargetPath" />
  81. <Target Name="Build" DependsOnTargets="$(BuildDependsOn)" />
  82. <!-- This project doesn't compile anything. -->
  83. <Target Name="CoreCompile" />
  84. <!-- Completely disable default targets for copying to output. -->
  85. <Target Name="CopyFilesToOutputDirectory" />
  86. <!-- This target finds the reference assemblies. -->
  87. <Target Name="_ResolveTargetingPackContent"
  88. Returns="@(AspNetCoreReferenceAssemblyPath)"
  89. BeforeTargets="_GetPackageFiles"
  90. DependsOnTargets="ResolveReferences;FindReferenceAssembliesForReferences">
  91. <ItemGroup>
  92. <_AvailableExtensionsRefAssemblies Include="$(MicrosoftInternalExtensionsRefsPath)\*.dll" />
  93. </ItemGroup>
  94. <JoinItems Left="@(ReferencePathWithRefAssemblies)" Right="@(_AvailableExtensionsRefAssemblies)" LeftKey="Filename" RightKey="Filename" ItemSpecToUse="Left">
  95. <Output TaskParameter="JoinResult" ItemName="_ReferencedExtensionsRefAssemblies" />
  96. </JoinItems>
  97. <!-- _DuplicatedExtensionsRefAssemblies represents ref assemblies that are present in Microsoft.Internal.Extensions.Refs package and also are built in this repo. -->
  98. <!-- This should be temporary while we migrate sources since there should be no duplication when sources are deleted from extensions. -->
  99. <JoinItems Left="@(_ReferencedExtensionsRefAssemblies)" Right="@(_ResolvedProjectReferencePaths)" LeftKey="Filename" RightKey="Filename" ItemSpecToUse="Left">
  100. <Output TaskParameter="JoinResult" ItemName="_DuplicatedExtensionsRefAssemblies" />
  101. </JoinItems>
  102. <JoinItems Left="@(_ReferencedExtensionsRefAssemblies)" Right="@(ExternalAspNetCoreAppReference)" LeftKey="Filename" RightKey="Identity" ItemSpecToUse="Left">
  103. <Output TaskParameter="JoinResult" ItemName="_SelectedExtensionsRefs" />
  104. </JoinItems>
  105. <JoinItems Left="@(ReferencePathWithRefAssemblies)" Right="@(_SelectedExtensionsRefs)" LeftKey="Filename" RightKey="Filename" ItemSpecToUse="Left">
  106. <Output TaskParameter="JoinResult" ItemName="_SelectedExtensionsRefAssemblies" />
  107. </JoinItems>
  108. <ItemGroup>
  109. <!-- Do not exclude the ref assemblies that we built in this repo if it's also included in Microsoft.Internal.Extensions.Refs -->
  110. <_ReferencedExtensionsRefAssembliesToExclude Include="@(_ReferencedExtensionsRefAssemblies)" Exclude="@(_DuplicatedExtensionsRefAssemblies)" />
  111. <!-- Exclude transitive external dependencies that are not directly referenced by projects in AspNetCore or Extensions -->
  112. <AspNetCoreReferenceAssemblyPath
  113. Include="@(ReferencePathWithRefAssemblies)"
  114. Condition="'%(ReferencePathWithRefAssemblies.IsReferenceAssembly)' == 'true'"
  115. Exclude="
  116. @(_ReferencedExtensionsRefAssembliesToExclude);
  117. @(ReferencePathWithRefAssemblies->WithMetadataValue('NuGetPackageId', 'Microsoft.NETCore.App.Ref'));
  118. @(ReferencePathWithRefAssemblies->WithMetadataValue('NuGetPackageId', 'System.Security.Cryptography.Pkcs'));
  119. @(ReferencePathWithRefAssemblies->WithMetadataValue('NuGetPackageId', 'System.Drawing.Common'));
  120. @(ReferencePathWithRefAssemblies->WithMetadataValue('NuGetPackageId', 'Microsoft.Win32.SystemEvents'));
  121. @(ReferencePathWithRefAssemblies->WithMetadataValue('ReferenceGrouping', 'Microsoft.NETCore.App'));" />
  122. <AspNetCoreReferenceAssemblyPath
  123. Include="@(_SelectedExtensionsRefAssemblies->'$(MicrosoftInternalExtensionsRefsPath)%(FileName)%(Extension)')" />
  124. <AspNetCoreReferenceDocXml Include="@(_ResolvedProjectReferencePaths->WithMetadataValue('IsReferenceAssembly', 'false')->'%(RootDir)%(Directory)%(FileName).xml')" />
  125. <AspNetCoreReferenceDocXml Include="@(_SelectedExtensionsRefAssemblies->'$(MicrosoftInternalExtensionsRefsPath)%(FileName).xml')" />
  126. <RefPackContent Include="@(AspNetCoreReferenceAssemblyPath)" PackagePath="$(RefAssemblyPackagePath)" />
  127. <RefPackContent Include="@(AspNetCoreReferenceDocXml)" PackagePath="$(RefAssemblyPackagePath)" />
  128. <RefPackContent Include="$(TargetDir)$(PackageConflictManifestFileName)" PackagePath="$(ManifestsPackagePath)" />
  129. <RefPackContent Include="$(ReferencePlatformManifestPath)" PackagePath="$(ManifestsPackagePath)" />
  130. </ItemGroup>
  131. </Target>
  132. <Target Name="GeneratePackageConflictManifest"
  133. DependsOnTargets="_ResolveTargetingPackContent"
  134. Inputs="$(MSBuildAllProjects)"
  135. Outputs="$(TargetDir)$(PackageConflictManifestFileName)">
  136. <ItemGroup>
  137. <!-- Use package version for non-Extensions references -->
  138. <_AspNetCoreAppPackageOverrides Include="@(AspNetCoreReferenceAssemblyPath->'%(NuGetPackageId)|%(NuGetPackageVersion)')" Condition="!Exists('$(MicrosoftInternalExtensionsRefsPath)%(AspNetCoreReferenceAssemblyPath.NuGetPackageId).dll') AND '%(AspNetCoreReferenceAssemblyPath.NuGetPackageId)' != 'Microsoft.NETCore.App' AND '%(AspNetCoreReferenceAssemblyPath.NuGetPackageId)' != 'Microsoft.Internal.Extensions.Refs' AND '%(AspNetCoreReferenceAssemblyPath.NuGetSourceType)' == 'Package' " />
  139. <!-- Pin version for extensions references -->
  140. <_AspNetCoreAppPackageOverrides Include="@(_SelectedExtensionsRefAssemblies->'%(FileName)|$(MicrosoftInternalExtensionsRefsPackageOverrideVersion)')" />
  141. <_AspNetCoreAppPackageOverrides Include="@(AspNetCoreReferenceAssemblyPath->'%(FileName)|$(ReferencePackSharedFxVersion)')" Condition=" '%(AspNetCoreReferenceAssemblyPath.ReferenceSourceTarget)' == 'ProjectReference' AND '%(AspNetCoreReferenceAssemblyPath.IsReferenceAssembly)' == 'true' " />
  142. </ItemGroup>
  143. <WriteLinesToFile
  144. Lines="@(_AspNetCoreAppPackageOverrides)"
  145. File="$(TargetDir)$(PackageConflictManifestFileName)"
  146. Overwrite="true" />
  147. </Target>
  148. <!-- Written to take advantage of target batching in MSBuild. -->
  149. <Target Name="_BatchCopyToLayoutTargetDir"
  150. DependsOnTargets="_ResolveTargetingPackContent"
  151. Inputs="@(RefPackContent)"
  152. Outputs="@(RefPackContent->'$(LayoutTargetDir)%(PackagePath)%(FileName)%(Extension)')">
  153. <Copy SourceFiles="@(RefPackContent)"
  154. DestinationFiles="@(RefPackContent->'$(LayoutTargetDir)%(PackagePath)%(FileName)%(Extension)')"
  155. UseHardlinksIfPossible="true" />
  156. <Message Importance="High" Text="$(MSBuildProjectName) -> $(LayoutTargetDir)" />
  157. </Target>
  158. <ItemGroup>
  159. <CreateDirectory Include="$(LocalInstallationOutputPath)" />
  160. </ItemGroup>
  161. <!-- Workaround https://github.com/dotnet/sdk/issues/2910 by copying targeting pack into local installation. -->
  162. <Target Name="_InstallTargetingPackIntoLocalDotNet"
  163. DependsOnTargets="_ResolveTargetingPackContent"
  164. Inputs="@(RefPackContent)"
  165. Outputs="@(RefPackContent->'$(LocalInstallationOutputPath)%(PackagePath)%(FileName)%(Extension)')">
  166. <Copy SourceFiles="@(RefPackContent)"
  167. DestinationFiles="@(RefPackContent->'$(LocalInstallationOutputPath)%(PackagePath)%(FileName)%(Extension)')"
  168. UseHardlinksIfPossible="true" />
  169. <Message Importance="High" Text="$(MSBuildProjectName) -> $(LocalInstallationOutputPath)" />
  170. </Target>
  171. <Target Name="_CreateTargetingPackArchive"
  172. Inputs="@(RefPackContent)"
  173. Outputs="$(ZipArchiveOutputPath);$(TarArchiveOutputPath)"
  174. Condition=" '$(IsPackable)' == 'true' ">
  175. <PropertyGroup>
  176. <_TarCommand>tar</_TarCommand>
  177. <_TarCommand Condition="Exists('$(RepoRoot).tools\tar.exe')">"$(RepoRoot).tools\tar.exe"</_TarCommand>
  178. <!-- For the tar packed with git, transform e.g. "C:\root\AspNetCore\File.tar.gz" to "/C/root/AspNetCore/File.tar.gz". -->
  179. <_TarArchiveOutputPath>$(TarArchiveOutputPath)</_TarArchiveOutputPath>
  180. <_TarArchiveOutputPath
  181. Condition="Exists('$(repoRoot)\.tools\tar.fromGit')">/$(TarArchiveOutputPath.Replace('\','/').Replace(':',''))</_TarArchiveOutputPath>
  182. </PropertyGroup>
  183. <ZipDirectory
  184. SourceDirectory="$(TargetingPackLayoutRoot)"
  185. DestinationFile="$(ZipArchiveOutputPath)"
  186. Overwrite="true" />
  187. <!-- Requires Windows 10 version 1803 or newer -->
  188. <Message Importance="High" Text="Executing: $(_TarCommand) -czf &quot;$(_TarArchiveOutputPath)&quot; ." />
  189. <Exec Command="$(_TarCommand) -czf &quot;$(_TarArchiveOutputPath)&quot; ."
  190. WorkingDirectory="$(TargetingPackLayoutRoot)" />
  191. <Message Importance="High" Text="$(MSBuildProjectName) -> $(TarArchiveOutputPath)" />
  192. </Target>
  193. <Target Name="IncludeFrameworkListFile"
  194. DependsOnTargets="_ResolveTargetingPackContent"
  195. BeforeTargets="_GetPackageFiles"
  196. Condition="'$(PackageTargetRuntime)' == '' AND '$(ManifestsPackagePath)' != ''">
  197. <RepoTasks.CreateFrameworkListFile
  198. Files="@(RefPackContent)"
  199. TargetFile="$(FrameworkListOutputPath)"
  200. RootAttributes="@(FrameworkListRootAttributes)" />
  201. <ItemGroup>
  202. <RefPackContent Include="$(FrameworkListOutputPath)" PackagePath="$(ManifestsPackagePath)" />
  203. <_PackageFiles Include="@(RefPackContent)" />
  204. </ItemGroup>
  205. </Target>
  206. </Project>