|
| 1 | +From 20eff0e62e16c49d0b02e861f2cc553d7de66061 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Davis Goodin < [email protected]> |
| 3 | +Date: Mon, 28 Dec 2020 11:20:26 -0600 |
| 4 | +Subject: [PATCH] Reference latest when running in build |
| 5 | + |
| 6 | +--- |
| 7 | + Directory.Build.targets | 35 +++++++++++++++++++ |
| 8 | + ...GenerateDocumentationAndConfigFiles.csproj | 3 ++ |
| 9 | + 2 files changed, 38 insertions(+) |
| 10 | + |
| 11 | +diff --git a/Directory.Build.targets b/Directory.Build.targets |
| 12 | +index 34e0b7966..6633a023a 100644 |
| 13 | +--- a/Directory.Build.targets |
| 14 | ++++ b/Directory.Build.targets |
| 15 | +@@ -14,6 +14,41 @@ |
| 16 | + </Content> |
| 17 | + </ItemGroup> |
| 18 | + |
| 19 | ++ <!-- |
| 20 | ++ If this project executes during the build (a tool project, rather than a project that compiles |
| 21 | ++ against reference assemblies for maximum compatibility), use the latest version of every package |
| 22 | ++ rather than whatever the transitive closure happens to include. In source-build, if we use an |
| 23 | ++ old reference-only package, it will fail to execute becuase methods are missing implementations. |
| 24 | ++ --> |
| 25 | ++ <ItemGroup Condition="'$(ExecutesDuringBuild)' == 'true'"> |
| 26 | ++ <ExecuteDuringBuildLatestPackageId Include="Microsoft.Bcl.AsyncInterfaces" /> |
| 27 | ++ <ExecuteDuringBuildLatestPackageId Include="System.Collections.Immutable" /> |
| 28 | ++ <ExecuteDuringBuildLatestPackageId Include="System.Composition" /> |
| 29 | ++ <ExecuteDuringBuildLatestPackageId Include="System.Composition.AttributedModel" /> |
| 30 | ++ <ExecuteDuringBuildLatestPackageId Include="System.Composition.Convention" /> |
| 31 | ++ <ExecuteDuringBuildLatestPackageId Include="System.Composition.Hosting" /> |
| 32 | ++ <ExecuteDuringBuildLatestPackageId Include="System.Composition.Runtime" /> |
| 33 | ++ <ExecuteDuringBuildLatestPackageId Include="System.Composition.TypedParts" /> |
| 34 | ++ <ExecuteDuringBuildLatestPackageId Include="System.Reflection.Metadata" /> |
| 35 | ++ <ExecuteDuringBuildLatestPackageId Include="System.Runtime.CompilerServices.Unsafe" /> |
| 36 | ++ <ExecuteDuringBuildLatestPackageId Include="System.Text.Encoding.CodePages" /> |
| 37 | ++ |
| 38 | ++ <!-- Find the name used by the PackageVersions.props infrastructure. --> |
| 39 | ++ <ExecuteDuringBuildLatestPackageId |
| 40 | ++ Update="@(ExecuteDuringBuildLatestPackageId)" |
| 41 | ++ VersionPropertyName="$([System.String]::new('%(Identity)').Replace('.',''))Version" /> |
| 42 | ++ |
| 43 | ++ <!-- |
| 44 | ++ If the package version property is set (we are running in source-build or have the version in |
| 45 | ++ eng/Versions.props), use it. |
| 46 | ++ --> |
| 47 | ++ <ExecuteDuringBuildLatestPackageId |
| 48 | ++ Update="@(ExecuteDuringBuildLatestPackageId)" |
| 49 | ++ Version="$(%(VersionPropertyName))" /> |
| 50 | ++ |
| 51 | ++ <PackageReference Include="@(ExecuteDuringBuildLatestPackageId->HasMetadata('Version'))" /> |
| 52 | ++ </ItemGroup> |
| 53 | ++ |
| 54 | + <ItemGroup Condition="'$(IsUnitTestProject)' == 'true'"> |
| 55 | + <PackageReference Include="coverlet.msbuild" Version="$(CoverletVersion)" PrivateAssets="all" /> |
| 56 | + </ItemGroup> |
| 57 | +diff --git a/src/Tools/GenerateDocumentationAndConfigFiles/GenerateDocumentationAndConfigFiles.csproj b/src/Tools/GenerateDocumentationAndConfigFiles/GenerateDocumentationAndConfigFiles.csproj |
| 58 | +index 181473c7f..51da76e35 100644 |
| 59 | +--- a/src/Tools/GenerateDocumentationAndConfigFiles/GenerateDocumentationAndConfigFiles.csproj |
| 60 | ++++ b/src/Tools/GenerateDocumentationAndConfigFiles/GenerateDocumentationAndConfigFiles.csproj |
| 61 | +@@ -8,6 +8,9 @@ |
| 62 | + <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
| 63 | + <MicrosoftCodeAnalysisVersion>$(MicrosoftCodeAnalysisForRoslynDiagnosticsAnalyzersVersion)</MicrosoftCodeAnalysisVersion> |
| 64 | + </PropertyGroup> |
| 65 | ++ <PropertyGroup> |
| 66 | ++ <ExecutesDuringBuild>true</ExecutesDuringBuild> |
| 67 | ++ </PropertyGroup> |
| 68 | + <ItemGroup> |
| 69 | + <Compile Include="..\..\Utilities\Compiler\Extensions\WellKnownDiagnosticTagsExtensions.cs" Link="WellKnownDiagnosticTagsExtensions.cs" /> |
| 70 | + <Compile Include="..\..\Utilities\Compiler\FxCopWellKnownDiagnosticTags.cs" Link="FxCopWellKnownDiagnosticTags.cs" /> |
| 71 | +-- |
| 72 | +2.25.4 |
| 73 | + |
0 commit comments