Skip to content

Commit eab3ae2

Browse files
authored
Disable baseline manifest generation (dotnet#43797)
2 parents 3c5b89f + 94fdf00 commit eab3ae2

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

src/Installer/redist-installer/targets/BundledManifests.targets

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,22 @@
103103
<Copy SourceFiles="@(ManifestContent)"
104104
DestinationFolder="$(RedistLayoutPath)sdk-manifests/%(DestinationPath)" />
105105

106+
</Target>
107+
108+
<PropertyGroup>
109+
<!-- NOTE: When setting this to true, we need to also add logic to include it in the exe installation bundle, either via a new MSI or by including it in an existing one. -->
110+
<GenerateBaselineWorkloadSet>false</GenerateBaselineWorkloadSet>
111+
</PropertyGroup>
112+
113+
<Target Name="LayoutBaselineWorkloadSet" DependsOnTargets="LayoutManifests" Condition="'$(GenerateBaselineWorkloadSet)' == 'true'">
114+
106115
<PropertyGroup>
107116
<WorkloadSetVersion Condition="'$(DotNetFinalVersionKind)' == 'release'">$(VersionPrefix)-baseline$(_BuildNumberLabels)</WorkloadSetVersion>
108117
<WorkloadSetVersion Condition="'$(DotNetFinalVersionKind)' != 'release'">$(Version)</WorkloadSetVersion>
109118
<WorkloadSetFeatureBand>$(VersionPrefix.Substring(0, $([MSBuild]::Subtract($(VersionPrefix.Length), 2))))00$([System.Text.RegularExpressions.Regex]::Match($(WorkloadSetVersion), `-[A-z]*[\.]*\d*`))</WorkloadSetFeatureBand>
110119
<RealFormattedManifestPaths>$(RedistLayoutPath)sdk-manifests\$(WorkloadSetFeatureBand)\workloadsets\$(WorkloadSetVersion)</RealFormattedManifestPaths>
111120
</PropertyGroup>
112121

113-
<ItemGroup>
114-
</ItemGroup>
115-
116122
<ItemGroup>
117123
<FormattedBaselineManifest Include="{" />
118124
<FormattedBaselineManifest Include="&quot;%(BundledManifests.Identity)&quot;: &quot;%(BundledManifests.Version)/%(BundledManifests.FeatureBand)&quot;," />

src/Installer/redist-installer/targets/GenerateLayout.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@
618618
LayoutRuntimeGraph;
619619
LayoutTemplates;
620620
LayoutManifests;
621+
LayoutBaselineWorkloadSet;
621622
LayoutWorkloadUserLocalMarker;
622623
LayoutBundledTools;
623624
RetargetTools;

src/Resolvers/Microsoft.NET.Sdk.WorkloadManifestReader/SdkDirectoryWorkloadManifestProvider.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,14 +547,31 @@ Dictionary<string, WorkloadSet> GetAvailableWorkloadSetsInternal(SdkFeatureBand?
547547

548548
static void AddWorkloadSetsForFeatureBand(Dictionary<string, WorkloadSet> availableWorkloadSets, string featureBandDirectory)
549549
{
550-
var featureBand = new SdkFeatureBand(Path.GetFileName(featureBandDirectory));
550+
var featureBandDirectoryName = Path.GetFileName(featureBandDirectory);
551+
var featureBand = new SdkFeatureBand(featureBandDirectoryName);
552+
if (!featureBandDirectoryName.Equals(featureBand.ToString()))
553+
{
554+
// A folder which should be a feature band parses as something that doesn't match the feature band. For example,
555+
// a folder named 9.0.100-rtm.24476 would parse as feature band 9.0.100. When we try to look up the workload set
556+
// later, we would look for it in a 9.0.100 folder, and wouldn't find it. So we will ignore these incorrect folders
557+
return;
558+
}
559+
551560
var workloadSetsRoot = Path.Combine(featureBandDirectory, WorkloadSetsFolderName);
552561
if (Directory.Exists(workloadSetsRoot))
553562
{
554563
foreach (var workloadSetDirectory in Directory.GetDirectories(workloadSetsRoot))
555564
{
556565
var workloadSetVersion = Path.GetFileName(workloadSetDirectory);
557566
var workloadSet = WorkloadSet.FromWorkloadSetFolder(workloadSetDirectory, workloadSetVersion, featureBand);
567+
568+
if (!WorkloadSet.GetWorkloadSetFeatureBand(workloadSet.Version!).Equals(featureBand))
569+
{
570+
// We have a workload set version where the feature band doesn't match the feature band folder that it's in.
571+
// Skip it, as if we try to actually load it via the workload set version, we'll fail
572+
continue;
573+
}
574+
558575
availableWorkloadSets[workloadSet.Version!] = workloadSet;
559576
}
560577
}

src/Resolvers/Microsoft.NET.Sdk.WorkloadManifestReader/WorkloadSet.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,5 +166,11 @@ public static string WorkloadSetVersionToWorkloadSetPackageVersion(string setVer
166166

167167
return packageVersion;
168168
}
169+
170+
public static SdkFeatureBand GetWorkloadSetFeatureBand(string setVersion)
171+
{
172+
WorkloadSetVersionToWorkloadSetPackageVersion(setVersion, out SdkFeatureBand sdkFeatureBand);
173+
return sdkFeatureBand;
174+
}
169175
}
170176
}

0 commit comments

Comments
 (0)