Skip to content

Commit

Permalink
Fix renamed/removed .NETCore workload for 2022
Browse files Browse the repository at this point in the history
The +core alias should now map to the minimal component for doing .NET6 development under 2022.

Fixes #106
  • Loading branch information
kzu committed Nov 5, 2021
1 parent 6b448eb commit c62c2c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/VisualStudio/Commands/InstallCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ public override async Task ExecuteAsync(TextWriter output)

args.AddRange(Descriptor.ExtraArguments);

// See also InstallerService.RunAsync where we do this mapping too.
var vs = Descriptor.Channel == null || Descriptor.Channel == Channel.Release ? "16" : "17";

// TODO: for now, we assume we're always doing an install.
var installBase = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Microsoft Visual Studio", "2019");
var installBase = vs == "16" ?
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Microsoft Visual Studio", "2019") :
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Microsoft Visual Studio", "2022");

// There is at least one install already, so use nicknames for the new one.
if (Directory.Exists(installBase) && !args.Contains("--nickname"))
Expand Down
5 changes: 5 additions & 0 deletions src/VisualStudio/InstallerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ public Task ModifyAsync(string channelUri, Sku? sku, IEnumerable<string> args, T
Task RunAsync(string command, Channel? channel, Sku? sku, IEnumerable<string> args, TextWriter output)
{
var vs = channel == null || channel == Channel.Release ? "16" : "17";

// Microsoft.VisualStudio.Workload.NetCoreTools > Microsoft.NetCore.Component.DevelopmentTools
if (vs == "17")
args = args.Select(arg => arg == "Microsoft.VisualStudio.Workload.NetCoreTools" ? "Microsoft.NetCore.Component.DevelopmentTools" : arg);

return RunAsync(command, $"https://aka.ms/vs/{vs}/{MapChannel(channel)}", sku, args, output);
}

Expand Down

0 comments on commit c62c2c8

Please sign in to comment.