Simplify ref/ assembly generation (#24136)
* Simplify ref/ assembly generation
- followup 1/2 for 5266918ed2
- correct the Razor.Tools project
- `%(Reference.Version)` metadata does not bleed through into `@(PackageReference)` items
- much more work to do so than to add this special case
- remove `$(Razor_NewtonsoftJsonPackageVersion)`
- remove RTMVersions project and use RepoTasks instead
- make it an error if RepoTasks is not restored before anything else builds
- add items and properties for System.Security.AccessControl
nits:
- remove invalid (ignored) metadata in Directory.Build.props and AzureAppServices.SiteExtension project
- improve / extend a couple of comments
- move `@(Reference)` items together in Microsoft.AspNetCore.Razor.Tools
This commit is contained in:
parent
d7bcde57d1
commit
fb28ce3ec2
|
|
@ -151,9 +151,7 @@
|
|||
Include="$(RepoRoot)src\Analyzers\Internal.AspNetCore.Analyzers\src\Internal.AspNetCore.Analyzers.csproj"
|
||||
ReferenceOutputAssembly="false"
|
||||
OutputItemType="Analyzer"
|
||||
PrivateAssets="All"
|
||||
Version="$(InternalAspNetCoreAnalyzersPackageVersion)"
|
||||
IsImplicitlyDefined="true" />
|
||||
PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Compilation options which apply to all languages. Language-specific options should be set in eng/targets/$(lang).Common.props -->
|
||||
|
|
|
|||
|
|
@ -44,10 +44,6 @@
|
|||
<!-- Project selection can be overridden on the command line by passing in -projects. -->
|
||||
<When Condition="'$(ProjectToBuild)' != ''">
|
||||
<ItemGroup>
|
||||
<!-- Include RTMVersions.csproj unless this invocation is building RepoTasks.csproj or won't compile C#. -->
|
||||
<ProjectToBuild Include="$(RepoRoot)eng\RTMVersions\RTMVersions.csproj"
|
||||
Exclude="@(ProjectToExclude)"
|
||||
Condition=" $(ProjectToBuild.EndsWith('.csproj')) AND !$(ProjectToBuild.EndsWith('RepoTasks.csproj')) " />
|
||||
<ProjectToBuild Include="$(ProjectToBuild)" Exclude="@(ProjectToExclude);$(RepoRoot)**\bin\**\*;$(RepoRoot)**\obj\**\*">
|
||||
<RestoreInParallel Condition="'%(Extension)' == '.npmproj'">false</RestoreInParallel>
|
||||
</ProjectToBuild>
|
||||
|
|
@ -125,11 +121,8 @@
|
|||
<!--
|
||||
Use caution to avoid deep recursion. If the globbing pattern picks up something which exceeds MAX_PATH,
|
||||
the entire pattern will silently fail to evaluate correctly.
|
||||
|
||||
Include RTMVersions.csproj when building any managed projects.
|
||||
-->
|
||||
<DotNetProjects Include="
|
||||
$(RepoRoot)eng\RTMVersions\RTMVersions.csproj;
|
||||
$(RepoRoot)src\Framework\App.Ref\src\Microsoft.AspNetCore.App.Ref.csproj;
|
||||
$(RepoRoot)src\Framework\App.Runtime\src\Microsoft.AspNetCore.App.Runtime.csproj;
|
||||
$(RepoRoot)src\Framework\App.Ref.Internal\src\Microsoft.AspNetCore.App.Ref.Internal.csproj;
|
||||
|
|
@ -178,7 +171,6 @@
|
|||
$(RepoRoot)**\obj\**\*;"
|
||||
Condition=" '$(BuildMainlyReferenceProviders)' != 'true' " />
|
||||
<DotNetProjects Include="
|
||||
$(RepoRoot)eng\RTMVersions\RTMVersions.csproj;
|
||||
$(RepoRoot)src\DefaultBuilder\**\src\*.csproj;
|
||||
$(RepoRoot)src\Features\JsonPatch\**\src\*.csproj;
|
||||
$(RepoRoot)src\DataProtection\**\src\*.csproj;
|
||||
|
|
|
|||
|
|
@ -71,6 +71,8 @@ and are generated based on the last package release.
|
|||
<LatestPackageReference Include="System.Reflection.Metadata" />
|
||||
<LatestPackageReference Include="System.Runtime.CompilerServices.Unsafe" />
|
||||
<LatestPackageReference Include="System.Runtime.InteropServices.RuntimeInformation" />
|
||||
<!-- System.Security.AccessControl should only be referenced in Dependencies.props and RTMVersions.csproj. -->
|
||||
<LatestPackageReference Include="System.Security.AccessControl" />
|
||||
<LatestPackageReference Include="System.Security.Cryptography.Cng" />
|
||||
<LatestPackageReference Include="System.Security.Cryptography.Pkcs" />
|
||||
<LatestPackageReference Include="System.Security.Cryptography.Xml" />
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
<Project>
|
||||
<!-- Minimize what gets set to avoid useless references in this simple project. -->
|
||||
<Import Project="..\Common.props" />
|
||||
<Import Project="..\Versions.props" />
|
||||
<Import Project="..\Dependencies.props" />
|
||||
</Project>
|
||||
|
|
@ -1 +0,0 @@
|
|||
<Project />
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<!--
|
||||
Gather project references for compilation against RTM packages. %(RTMVersion) is set for about a dozen packages
|
||||
in all servicing builds. Cannot reference two versions of a package, mandating this separate package.
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
|
||||
<!-- Don't bother building anything here. We only need to ensure the RTM packages are on disk. -->
|
||||
<DebugType>none</DebugType>
|
||||
<IncludeBuildOutput>false</IncludeBuildOutput>
|
||||
<CopyBuildOutputToPublishDirectory>false</CopyBuildOutputToPublishDirectory>
|
||||
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
|
||||
<CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
|
||||
<GenerateDependencyFile>false</GenerateDependencyFile>
|
||||
|
||||
<!-- This project should not be referenced via the `<Reference>` implementation. -->
|
||||
<IsProjectReferenceProvider>false</IsProjectReferenceProvider>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="@(LatestPackageReference->HasMetadata('RTMVersion'))" Version="%(RTMVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Arcade SDK calls Test target on every project in the repo but provides an empty fallback. Do same here. -->
|
||||
<Target Name="Test" />
|
||||
</Project>
|
||||
|
|
@ -233,6 +233,11 @@
|
|||
<Uri>https://github.com/dotnet/runtime</Uri>
|
||||
<Sha>f37dd6fc8595e130909dcb3085a56342d04aa20c</Sha>
|
||||
</Dependency>
|
||||
<!-- System.Security.AccessControl should only be referenced in Dependencies.props and RTMVersions.csproj. -->
|
||||
<Dependency Name="System.Security.AccessControl" Version="5.0.0-preview.8.20361.2">
|
||||
<Uri>https://github.com/dotnet/runtime</Uri>
|
||||
<Sha>f37dd6fc8595e130909dcb3085a56342d04aa20c</Sha>
|
||||
</Dependency>
|
||||
<Dependency Name="System.Security.Cryptography.Cng" Version="5.0.0-preview.8.20361.2">
|
||||
<Uri>https://github.com/dotnet/runtime</Uri>
|
||||
<Sha>f37dd6fc8595e130909dcb3085a56342d04aa20c</Sha>
|
||||
|
|
|
|||
|
|
@ -116,6 +116,8 @@
|
|||
<SystemReflectionMetadataPackageVersion>5.0.0-preview.8.20361.2</SystemReflectionMetadataPackageVersion>
|
||||
<SystemResourcesExtensionsPackageVersion>5.0.0-preview.8.20361.2</SystemResourcesExtensionsPackageVersion>
|
||||
<SystemRuntimeCompilerServicesUnsafePackageVersion>5.0.0-preview.8.20361.2</SystemRuntimeCompilerServicesUnsafePackageVersion>
|
||||
<!-- System.Security.AccessControl should only be referenced in Dependencies.props and RTMVersions.csproj. -->
|
||||
<SystemSecurityAccessControlPackageVersion>5.0.0-preview.8.20361.2</SystemSecurityAccessControlPackageVersion>
|
||||
<SystemSecurityCryptographyCngPackageVersion>5.0.0-preview.8.20361.2</SystemSecurityCryptographyCngPackageVersion>
|
||||
<SystemSecurityCryptographyPkcsPackageVersion>5.0.0-preview.8.20361.2</SystemSecurityCryptographyPkcsPackageVersion>
|
||||
<SystemSecurityCryptographyXmlPackageVersion>5.0.0-preview.8.20361.2</SystemSecurityCryptographyXmlPackageVersion>
|
||||
|
|
@ -163,6 +165,14 @@
|
|||
Upshot is we need Major.Minor.0 runtime packages for compilation and the targeting pack and Major.Minor.Latest
|
||||
runtime packages for everything else. This is not an issue for assemblies available in Microsoft.NETCore.App.Ref or
|
||||
Microsoft.Extensions.Internal.Transport because it is next to impossible we would service those packages.
|
||||
|
||||
System.Security.AccessControl should only be referenced in Dependencies.props and RTMVersions.csproj. Because
|
||||
it's a transitive reference, we reship the ref/ assembly in Microsoft.AspNetCore.App.Ref. dotnet/runtime ships
|
||||
the implementation assemblies in Microsoft.NETCore.App.Runtime.* packages.
|
||||
|
||||
If testing this configuration prior to servicing, update the versions of dependencies too. E.g. change
|
||||
`$(SystemSecurityPrincipalWindowsV0PackageVersion)` if you change `$(SystemSecurityAccessControlV0PackageVersion)`
|
||||
because System.Security.AccessControl will otherwise be loadable. This should not be necessary in servicing.
|
||||
-->
|
||||
<PropertyGroup Condition=" '$(IsServicingBuild)' == 'true' ">
|
||||
<MicrosoftWin32RegistryV0PackageVersion>$(MicrosoftWin32RegistryPackageVersion.Split('.')[0]).$(MicrosoftWin32RegistryPackageVersion.Split('.')[1]).0</MicrosoftWin32RegistryV0PackageVersion>
|
||||
|
|
@ -252,9 +262,6 @@
|
|||
<MonoCecilPackageVersion>0.11.2</MonoCecilPackageVersion>
|
||||
<NewtonsoftJsonBsonPackageVersion>1.0.2</NewtonsoftJsonBsonPackageVersion>
|
||||
<NewtonsoftJsonPackageVersion>12.0.2</NewtonsoftJsonPackageVersion>
|
||||
<!-- Begin: STOP!!! Razor need to reference the version of JSON that our HOSTS support. -->
|
||||
<Razor_NewtonsoftJsonPackageVersion>9.0.1</Razor_NewtonsoftJsonPackageVersion>
|
||||
<!-- End: STOP!!! Razor need to reference the version of JSON that our HOSTS support. -->
|
||||
<NSwagApiDescriptionClientPackageVersion>13.0.4</NSwagApiDescriptionClientPackageVersion>
|
||||
<SeleniumSupportPackageVersion>3.12.1</SeleniumSupportPackageVersion>
|
||||
<SeleniumWebDriverMicrosoftDriverPackageVersion>17.17134.0</SeleniumWebDriverMicrosoftDriverPackageVersion>
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@
|
|||
</Target>
|
||||
|
||||
<!--
|
||||
This target resolves remaining Referene items to Packages, if possible. If not, they are left as Reference items fo the SDK to resolve.
|
||||
This target resolves remaining Reference items to Packages, if possible. If not, they are left as Reference items fo the SDK to resolve.
|
||||
This executes on NuGet restore and during DesignTimeBuild. It should not run in the outer, cross-targeting build.
|
||||
-->
|
||||
<Target Name="ResolveCustomReferences"
|
||||
|
|
@ -205,21 +205,23 @@
|
|||
</Target>
|
||||
|
||||
<!--
|
||||
Muck with @(ResolvedCompileFileDefinitions) items between generation and use in order to compile against RTM lib/
|
||||
Change @(ResolvedCompileFileDefinitions) items between generation and use in order to compile against RTM lib/
|
||||
or ref/ assemblies. The approach works for all TFMs because it happens after a specific assembly is chosen for
|
||||
compilation; no need to restrict this to (say) the default TFM.
|
||||
|
||||
Condition checks for RTMVersions.csproj.nuget.g.props file only to ensure restore operation is complete.
|
||||
|
||||
This target could get confused if the layout changes for one of the dozen special-cased packages during servicing.
|
||||
E.g. ResolvePackageAssets picks a compatible assembly from the 5.0.1 package and _UseRTMReferenceAssemblies
|
||||
changes the path to one not present in the 5.0.0 package. Fortunately, this will break the build with complaints
|
||||
about the "invalid strong name".
|
||||
-->
|
||||
<Target Name="_UseRTMReferenceAssemblies"
|
||||
Condition=" '$(EnableCustomReferenceResolution)' == 'true' AND EXISTS('$(RepoRoot)eng\RTMVersions\obj\RTMVersions.csproj.nuget.g.props') "
|
||||
Condition=" '$(MSBuildProjectName)' != 'RepoTasks' "
|
||||
AfterTargets="ResolvePackageAssets"
|
||||
BeforeTargets="GenerateBuildDependencyFile;GeneratePublishDependencyFile;ILLink;ResolveLockFileReferences"
|
||||
DependsOnTargets="ResolvePackageAssets">
|
||||
<Error Condition=" !EXISTS('$(RepoRoot)artifacts\obj\RepoTasks\RepoTasks.csproj.nuget.g.props') "
|
||||
Text="The eng/tools/RepoTasks project must be restored before building other projects." />
|
||||
|
||||
<JoinItems Left="@(ResolvedCompileFileDefinitions)"
|
||||
Right="@(LatestPackageReference->HasMetadata('RTMVersion'))"
|
||||
LeftKey="Filename"
|
||||
|
|
|
|||
|
|
@ -36,5 +36,15 @@
|
|||
<Reference Include="Microsoft.Deployment.WindowsInstaller.Package">
|
||||
<HintPath>$(WiXSdkPath)\Microsoft.Deployment.WindowsInstaller.Package.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
<!--
|
||||
Gather project references for compilation against RTM packages. %(RTMVersion) is set for about a dozen packages
|
||||
in all servicing builds. Cannot reference two versions of a package, mandating this separation from projects
|
||||
using the relevant packages.
|
||||
-->
|
||||
<PackageReference Include="@(LatestPackageReference->HasMetadata('RTMVersion'))"
|
||||
IncludeAssets="None"
|
||||
PrivateAssets="All"
|
||||
Version="%(RTMVersion)" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -36,13 +36,10 @@
|
|||
<Compile Include="$(SharedSourceRoot)CommandLineUtils\**\*.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json" Version="$(Razor_NewtonsoftJsonPackageVersion)" />
|
||||
<Reference Include="Microsoft.Css.Parser" Version="$(MicrosoftCssParserPackageVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CodeAnalysis.Razor" />
|
||||
<Reference Include="Microsoft.Css.Parser" />
|
||||
<Reference Include="Newtonsoft.Json" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- This makes it so that the runtimeconfig.json is included as part of the build output of the project that references this project. -->
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.AspNetCore.AzureAppServices.SiteExtension.2.1" Version="$(MicrosoftAspNetCoreAzureAppServicesSiteExtension21PackageVersion)" PrivateAssets="All" />
|
||||
<Reference Include="Microsoft.AspNetCore.AzureAppServices.SiteExtension.2.2" Version="$(MicrosoftAspNetCoreAzureAppServicesSiteExtension22PackageVersion)" PrivateAssets="All" />
|
||||
<Reference Include="Microsoft.AspNetCore.AzureAppServices.SiteExtension.3.1.x64" Version="$(MicrosoftAspNetCoreAzureAppServicesSiteExtension31PackageVersion)" PrivateAssets="All" />
|
||||
<Reference Include="Microsoft.AspNetCore.AzureAppServices.SiteExtension.3.1.x86" Version="$(MicrosoftAspNetCoreAzureAppServicesSiteExtension31PackageVersion)" PrivateAssets="All" />
|
||||
<Reference Include="Microsoft.AspNetCore.AzureAppServices.SiteExtension.2.1" PrivateAssets="All" />
|
||||
<Reference Include="Microsoft.AspNetCore.AzureAppServices.SiteExtension.2.2" PrivateAssets="All" />
|
||||
<Reference Include="Microsoft.AspNetCore.AzureAppServices.SiteExtension.3.1.x64" PrivateAssets="All" />
|
||||
<Reference Include="Microsoft.AspNetCore.AzureAppServices.SiteExtension.3.1.x86" PrivateAssets="All" />
|
||||
<!-- When updating this add the previous SiteExtension(s) to the list above -->
|
||||
<PackageReference Include="Microsoft.AspNetCore.AzureAppServices.SiteExtension.5.0.x86" Version="$(PackageVersion)" PrivateAssets="All" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.AzureAppServices.SiteExtension.5.0.x64" Version="$(PackageVersion)" PrivateAssets="All" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue