Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[automated] Merge branch 'release/9.0.1xx' => 'release/9.0.2xx' #43759

Merged
merged 63 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
2a6c765
Unstable branding with rtm label and empty iteration
marcpopMSFT Sep 16, 2024
fff5caf
Update dependencies from https://github.com/dotnet/test-templates bui…
dotnet-maestro[bot] Sep 24, 2024
7c4b69a
Update dependencies from https://github.com/dotnet/roslyn build 20240…
dotnet-maestro[bot] Sep 24, 2024
176534d
Update dependencies from https://github.com/dotnet/sourcelink build 2…
dotnet-maestro[bot] Sep 24, 2024
b73e17c
Update dependencies from https://github.com/dotnet/arcade build 20240…
dotnet-maestro[bot] Sep 24, 2024
a1b2cf8
Update dependencies from https://github.com/dotnet/aspnetcore build 2…
dotnet-maestro[bot] Sep 24, 2024
a83fb61
Update dependencies from https://github.com/dotnet/aspnetcore build 2…
dotnet-maestro[bot] Sep 24, 2024
8a69d23
Support additional VS component IDs for workloads
joeloff Sep 24, 2024
f5ad8ca
[release/9.0.1xx] Update dependencies from dotnet/aspnetcore (#43669)
v-wuzhai Sep 25, 2024
6eea54c
[release/9.0.1xx] Update dependencies from dotnet/arcade (#43666)
v-wuzhai Sep 25, 2024
8650172
[release/9.0.1xx] Update dependencies from dotnet/sourcelink (#43665)
v-wuzhai Sep 25, 2024
e56b19d
[release/9.0.1xx] Update dependencies from dotnet/roslyn (#43663)
v-wuzhai Sep 25, 2024
1e3e85c
[release/9.0.1xx] Update dependencies from dotnet/test-templates (#43…
v-wuzhai Sep 25, 2024
138bd65
Update dependencies from https://github.com/nuget/nuget.client build …
dotnet-maestro[bot] Sep 25, 2024
3f88442
[release/9.0.1xx] Update dependencies from nuget/nuget.client (#43683)
joeloff Sep 25, 2024
974f92d
Update dependencies from https://github.com/dotnet/windowsdesktop bui…
dotnet-maestro[bot] Sep 25, 2024
a47f50f
BinSkim: Enable CFG
joeloff Sep 25, 2024
97eb66b
Update dependencies from https://github.com/dotnet/scenario-tests bui…
dotnet-maestro[bot] Sep 25, 2024
c490f2b
Update to the new build of scenario-tests to remove the workload unin…
marcpopMSFT Sep 25, 2024
4d2b7a8
Update dependencies from https://github.com/dotnet/runtime build 2024…
dotnet-maestro[bot] Sep 26, 2024
2bf4079
[release/9.0.1xx] Update dependencies from dotnet/runtime (#43702)
v-wuzhai Sep 26, 2024
be38375
[release/9.0.1xx] Update dependencies from dotnet/scenario-tests (#43…
v-wuzhai Sep 26, 2024
f59e9ca
[release/9.0.1xx] Update dependencies from dotnet/windowsdesktop (#43…
v-wuzhai Sep 26, 2024
b47f710
Update dependencies from https://github.com/dotnet/xdt build 20240925.1
dotnet-maestro[bot] Sep 26, 2024
786f842
Update dependencies from https://github.com/dotnet/xdt build 20240926.1
dotnet-maestro[bot] Sep 26, 2024
31dfaff
Update dependencies from https://github.com/dotnet/test-templates bui…
dotnet-maestro[bot] Sep 26, 2024
4ac3010
Update dependencies from https://github.com/dotnet/roslyn build 20240…
dotnet-maestro[bot] Sep 26, 2024
d932504
Update dependencies from https://github.com/dotnet/fsharp build 20240…
dotnet-maestro[bot] Sep 26, 2024
9edcf31
Update dependencies from https://github.com/nuget/nuget.client build …
dotnet-maestro[bot] Sep 26, 2024
44cd339
Update dependencies from https://github.com/dotnet/aspnetcore build 2…
dotnet-maestro[bot] Sep 26, 2024
8965b65
Update dependencies from https://github.com/nuget/nuget.client build …
dotnet-maestro[bot] Sep 26, 2024
0dd593d
Unstable branding with rtm label and empty iteration (#43483)
marcpopMSFT Sep 27, 2024
b9a6748
[release/9.0.1xx] Update dependencies from dotnet/xdt (#43704)
v-wuzhai Sep 27, 2024
7bdd10b
Update dependencies from https://github.com/dotnet/razor build 202409…
dotnet-maestro[bot] Sep 27, 2024
ee48a2e
Update dependencies from https://github.com/dotnet/windowsdesktop bui…
dotnet-maestro[bot] Sep 27, 2024
80eb46f
[release/9.0.1xx] Update dependencies from dotnet/aspnetcore (#43734)
v-wuzhai Sep 27, 2024
8bf8c85
[release/9.0.1xx] Update dependencies from nuget/nuget.client (#43733)
v-wuzhai Sep 27, 2024
a6d4684
[release/9.0.1xx] Update dependencies from dotnet/fsharp (#43728)
v-wuzhai Sep 27, 2024
a0cf435
[release/9.0.1xx] Update dependencies from dotnet/roslyn (#43719)
v-wuzhai Sep 27, 2024
08c11eb
[release/9.0.1xx] Update dependencies from dotnet/test-templates (#43…
v-wuzhai Sep 27, 2024
2fa01d1
[release/9.0.1xx] Update dependencies from dotnet/razor (#43741)
v-wuzhai Sep 27, 2024
89de440
[release/9.0.1xx] Update dependencies from dotnet/windowsdesktop (#43…
v-wuzhai Sep 27, 2024
3af0237
Update dependencies from https://github.com/dotnet/roslyn build 20240…
dotnet-maestro[bot] Sep 27, 2024
eb567ff
Update dependencies from https://github.com/dotnet/msbuild build 2024…
dotnet-maestro[bot] Sep 27, 2024
48eed1c
Update dependencies from https://github.com/dotnet/sourcelink build 2…
dotnet-maestro[bot] Sep 27, 2024
1b8891c
Update dependencies from https://github.com/dotnet/runtime build 2024…
dotnet-maestro[bot] Sep 27, 2024
fc26991
Update dependencies from https://github.com/dotnet/fsharp build 20240…
dotnet-maestro[bot] Sep 27, 2024
c0cd95f
[release/9.0.1xx] BinSkim: Enable CFG (#43695)
joeloff Sep 27, 2024
428c096
Support additional VS component IDs for workloads (#43675)
joeloff Sep 27, 2024
edf70c9
Update dependencies from https://github.com/dotnet/test-templates bui…
dotnet-maestro[bot] Sep 27, 2024
6953fde
Update dependencies from https://github.com/dotnet/test-templates bui…
dotnet-maestro[bot] Sep 27, 2024
9a6f854
[release/9.0.1xx] Update dependencies from dotnet/fsharp (#43757)
joeloff Sep 27, 2024
455ab2a
Update dependencies from https://github.com/dotnet/test-templates bui…
dotnet-maestro[bot] Sep 27, 2024
076ccdf
[release/9.0.1xx] Update dependencies from dotnet/test-templates (#43…
joeloff Sep 27, 2024
b8db73d
[release/9.0.1xx] Update dependencies from dotnet/roslyn (#43751)
joeloff Sep 27, 2024
f73692a
[release/9.0.1xx] Update dependencies from dotnet/sourcelink (#43753)
joeloff Sep 27, 2024
137d110
Update dependencies from https://github.com/dotnet/aspnetcore build 2…
dotnet-maestro[bot] Sep 27, 2024
34aa341
[release/9.0.1xx] Update dependencies from dotnet/msbuild (#43752)
marcpopMSFT Sep 27, 2024
083996f
Update dependencies from https://github.com/dotnet/aspnetcore build 2…
dotnet-maestro[bot] Sep 28, 2024
1e6ba32
[release/9.0.1xx] Update dependencies from dotnet/runtime (#43754)
joeloff Sep 28, 2024
66eeda2
[release/9.0.1xx] Update dependencies from dotnet/aspnetcore (#43767)
joeloff Sep 28, 2024
92076d1
Merge branch 'release/9.0.2xx' of https://github.com/dotnet/sdk into …
v-wuzhai Sep 29, 2024
014b168
Revert arcade codeflow
v-wuzhai Sep 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Runtime.Versioning;
using Microsoft.Deployment.DotNet.Releases;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ToolPackage;
using Microsoft.DotNet.Workloads.Workload.Install;
using Microsoft.DotNet.Workloads.Workload.List;
using Microsoft.NET.Sdk.WorkloadManifestReader;
Expand Down Expand Up @@ -33,19 +32,61 @@ internal static class VisualStudioWorkloads
"Microsoft.VisualStudio.Product.Enterprise",
};

/// <summary>
/// Default prefix to use for Visual Studio component and component group IDs.
/// </summary>
private static readonly string s_visualStudioComponentPrefix = "Microsoft.NET.Component";

/// <summary>
/// Well-known prefixes used by some workloads that can be replaced when generating component IDs.
/// </summary>
private static readonly string[] s_wellKnownWorkloadPrefixes = { "Microsoft.NET.", "Microsoft." };

/// <summary>
/// The SWIX package ID wrapping the SDK installer in Visual Studio. The ID should contain
/// the SDK version as a suffix, e.g., "Microsoft.NetCore.Toolset.5.0.403".
/// </summary>
private static readonly string s_visualStudioSdkPackageIdPrefix = "Microsoft.NetCore.Toolset.";

/// <summary>
/// Gets a set of workload components based on the available set of workloads for the current SDK.
/// Gets a dictionary of mapping possible Visual Studio component IDs to .NET workload IDs in the current SDK.
/// </summary>
/// <param name="workloadResolver">The workload resolver used to obtain available workloads.</param>
/// <returns>A collection of Visual Studio component IDs corresponding to workload IDs.</returns>
internal static IEnumerable<string> GetAvailableVisualStudioWorkloads(IWorkloadResolver workloadResolver) =>
workloadResolver.GetAvailableWorkloads().Select(w => w.Id.ToString().Replace('-', '.'));
/// <returns>A dictionary of Visual Studio component IDs corresponding to workload IDs.</returns>
internal static Dictionary<string, string> GetAvailableVisualStudioWorkloads(IWorkloadResolver workloadResolver)
{
Dictionary<string, string> visualStudioComponentWorkloads = new(StringComparer.OrdinalIgnoreCase);

// Iterate through all the available workload IDs and generate potential Visual Studio
// component IDs that map back to the original workload ID. This ensures that we
// can do reverse lookups for special cases where a workload ID contains a prefix
// corresponding with the full VS component ID prefix. For example,
// Microsoft.NET.Component.runtime.android would be a valid component ID for both
// microsoft-net-runtime-android and runtime-android.
foreach (var workload in workloadResolver.GetAvailableWorkloads())
{
string workloadId = workload.Id.ToString();
// Old style VS components simply replaced '-' with '.' in the workload ID.
string componentId = workload.Id.ToString().Replace('-', '.');

visualStudioComponentWorkloads.Add(componentId, workloadId);

// Starting in .NET 9.0 and VS 17.12, workload components will follow the VS naming convention.
foreach (string wellKnownPrefix in s_wellKnownWorkloadPrefixes)
{
if (componentId.StartsWith(wellKnownPrefix, StringComparison.OrdinalIgnoreCase))
{
componentId = componentId.Substring(wellKnownPrefix.Length);
break;
}
}

componentId = s_visualStudioComponentPrefix + "." + componentId;
visualStudioComponentWorkloads.Add(componentId, workloadId);
}

return visualStudioComponentWorkloads;
}

/// <summary>
/// Finds all workloads installed by all Visual Studio instances given that the
Expand All @@ -59,7 +100,7 @@ internal static IEnumerable<string> GetAvailableVisualStudioWorkloads(IWorkloadR
internal static void GetInstalledWorkloads(IWorkloadResolver workloadResolver,
InstalledWorkloadsCollection installedWorkloads, SdkFeatureBand? sdkFeatureBand = null)
{
IEnumerable<string> visualStudioWorkloadIds = GetAvailableVisualStudioWorkloads(workloadResolver);
Dictionary<string, string> visualStudioWorkloadIds = GetAvailableVisualStudioWorkloads(workloadResolver);
HashSet<string> installedWorkloadComponents = new();

// Visual Studio instances contain a large set of packages and we have to perform a linear
Expand Down Expand Up @@ -105,10 +146,9 @@ internal static void GetInstalledWorkloads(IWorkloadResolver workloadResolver,
continue;
}

if (visualStudioWorkloadIds.Contains(packageId, StringComparer.OrdinalIgnoreCase))
if (visualStudioWorkloadIds.TryGetValue(packageId, out string workloadId))
{
// Normalize back to an SDK style workload ID.
installedWorkloadComponents.Add(packageId.Replace('.', '-'));
installedWorkloadComponents.Add(workloadId);
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/Installer/finalizer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/we4703>) # Potentially uninitia
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/we4789>) # destination of memory copy is too small
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/we4995>) # 'function': name was marked as #pragma deprecated
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/we4996>) # 'function': was declared deprecated also 'std::'
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/guard:cf>) # Enable control flow guard

add_executable(Finalizer
finalizer.cpp
native.rc
)

add_link_options(/guard:cf)

# These are normally part of a .vcxproj in Visual Studio, but appears to be missing when CMAKE generates a .vcxproj for arm64.
target_link_libraries(Finalizer shell32.lib)
target_link_libraries(Finalizer advapi32.lib)
Expand Down
13 changes: 13 additions & 0 deletions test/dotnet-workload-list.Tests/GivenDotnetWorkloadList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.CommandLine;
using ManifestReaderTests;
using Microsoft.DotNet.Workloads.Workload;
using Microsoft.DotNet.Workloads.Workload.List;
using Microsoft.NET.Sdk.WorkloadManifestReader;
using ListStrings = Microsoft.DotNet.Workloads.Workload.List.LocalizableStrings;
Expand Down Expand Up @@ -37,6 +38,18 @@ public void GivenNoWorkloadsAreInstalledListIsEmpty()
_reporter.Lines.Count.Should().Be(6);
}

[WindowsOnlyFact]
public void GivenAvailableWorkloadsItCanComputeVisualStudioIds()
{
var workloadResolver = WorkloadResolver.CreateForTests(new MockManifestProvider(("SampleManifest", _manifestPath, "5.0.0", "6.0.100")), Directory.GetCurrentDirectory());

#pragma warning disable CA1416 // Validate platform compatibility
var availableWorkloads = VisualStudioWorkloads.GetAvailableVisualStudioWorkloads(workloadResolver);
availableWorkloads.Should().Contain("mock.workload.1", "mock-workload-1");
availableWorkloads.Should().Contain("Microsoft.NET.Component.mock.workload.1", "mock-workload-1");
#pragma warning restore CA1416 // Validate platform compatibility
}

[Fact]
public void GivenNoWorkloadsAreInstalledMachineReadableListIsEmpty()
{
Expand Down
Loading