Skip to content

Commit 32c2795

Browse files
committed
Add legacy dotnet-vs package pointing users to dnx vs
Ship a source-linked companion tool package under the historical dotnet-vs id so existing global-tool installs keep working, while steering users to dnx vs via a post-run notice and package readme.
1 parent b00ce17 commit 32c2795

5 files changed

Lines changed: 259 additions & 30 deletions

File tree

VisualStudio.sln

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,63 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1818
EndProject
1919
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VisualStudio.Tests", "src\VisualStudio.Tests\VisualStudio.Tests.csproj", "{D379D36D-60D5-4CB4-B34C-B86FF9E3F956}"
2020
EndProject
21+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72D-47B6-A68D-7590B98EB39B}"
22+
EndProject
23+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnet-vs", "src\dotnet-vs\dotnet-vs.csproj", "{1D7E318C-D0F5-4713-A793-EE38AC2FDF00}"
24+
EndProject
2125
Global
2226
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2327
Debug|Any CPU = Debug|Any CPU
28+
Debug|x64 = Debug|x64
29+
Debug|x86 = Debug|x86
2430
Release|Any CPU = Release|Any CPU
31+
Release|x64 = Release|x64
32+
Release|x86 = Release|x86
2533
EndGlobalSection
2634
GlobalSection(ProjectConfigurationPlatforms) = postSolution
2735
{8CBD9F8C-F635-4E55-A593-91FFDB2312AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2836
{8CBD9F8C-F635-4E55-A593-91FFDB2312AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
37+
{8CBD9F8C-F635-4E55-A593-91FFDB2312AF}.Debug|x64.ActiveCfg = Debug|Any CPU
38+
{8CBD9F8C-F635-4E55-A593-91FFDB2312AF}.Debug|x64.Build.0 = Debug|Any CPU
39+
{8CBD9F8C-F635-4E55-A593-91FFDB2312AF}.Debug|x86.ActiveCfg = Debug|Any CPU
40+
{8CBD9F8C-F635-4E55-A593-91FFDB2312AF}.Debug|x86.Build.0 = Debug|Any CPU
2941
{8CBD9F8C-F635-4E55-A593-91FFDB2312AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
3042
{8CBD9F8C-F635-4E55-A593-91FFDB2312AF}.Release|Any CPU.Build.0 = Release|Any CPU
43+
{8CBD9F8C-F635-4E55-A593-91FFDB2312AF}.Release|x64.ActiveCfg = Release|Any CPU
44+
{8CBD9F8C-F635-4E55-A593-91FFDB2312AF}.Release|x64.Build.0 = Release|Any CPU
45+
{8CBD9F8C-F635-4E55-A593-91FFDB2312AF}.Release|x86.ActiveCfg = Release|Any CPU
46+
{8CBD9F8C-F635-4E55-A593-91FFDB2312AF}.Release|x86.Build.0 = Release|Any CPU
3147
{D379D36D-60D5-4CB4-B34C-B86FF9E3F956}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3248
{D379D36D-60D5-4CB4-B34C-B86FF9E3F956}.Debug|Any CPU.Build.0 = Debug|Any CPU
49+
{D379D36D-60D5-4CB4-B34C-B86FF9E3F956}.Debug|x64.ActiveCfg = Debug|Any CPU
50+
{D379D36D-60D5-4CB4-B34C-B86FF9E3F956}.Debug|x64.Build.0 = Debug|Any CPU
51+
{D379D36D-60D5-4CB4-B34C-B86FF9E3F956}.Debug|x86.ActiveCfg = Debug|Any CPU
52+
{D379D36D-60D5-4CB4-B34C-B86FF9E3F956}.Debug|x86.Build.0 = Debug|Any CPU
3353
{D379D36D-60D5-4CB4-B34C-B86FF9E3F956}.Release|Any CPU.ActiveCfg = Release|Any CPU
3454
{D379D36D-60D5-4CB4-B34C-B86FF9E3F956}.Release|Any CPU.Build.0 = Release|Any CPU
55+
{D379D36D-60D5-4CB4-B34C-B86FF9E3F956}.Release|x64.ActiveCfg = Release|Any CPU
56+
{D379D36D-60D5-4CB4-B34C-B86FF9E3F956}.Release|x64.Build.0 = Release|Any CPU
57+
{D379D36D-60D5-4CB4-B34C-B86FF9E3F956}.Release|x86.ActiveCfg = Release|Any CPU
58+
{D379D36D-60D5-4CB4-B34C-B86FF9E3F956}.Release|x86.Build.0 = Release|Any CPU
59+
{1D7E318C-D0F5-4713-A793-EE38AC2FDF00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
60+
{1D7E318C-D0F5-4713-A793-EE38AC2FDF00}.Debug|Any CPU.Build.0 = Debug|Any CPU
61+
{1D7E318C-D0F5-4713-A793-EE38AC2FDF00}.Debug|x64.ActiveCfg = Debug|Any CPU
62+
{1D7E318C-D0F5-4713-A793-EE38AC2FDF00}.Debug|x64.Build.0 = Debug|Any CPU
63+
{1D7E318C-D0F5-4713-A793-EE38AC2FDF00}.Debug|x86.ActiveCfg = Debug|Any CPU
64+
{1D7E318C-D0F5-4713-A793-EE38AC2FDF00}.Debug|x86.Build.0 = Debug|Any CPU
65+
{1D7E318C-D0F5-4713-A793-EE38AC2FDF00}.Release|Any CPU.ActiveCfg = Release|Any CPU
66+
{1D7E318C-D0F5-4713-A793-EE38AC2FDF00}.Release|Any CPU.Build.0 = Release|Any CPU
67+
{1D7E318C-D0F5-4713-A793-EE38AC2FDF00}.Release|x64.ActiveCfg = Release|Any CPU
68+
{1D7E318C-D0F5-4713-A793-EE38AC2FDF00}.Release|x64.Build.0 = Release|Any CPU
69+
{1D7E318C-D0F5-4713-A793-EE38AC2FDF00}.Release|x86.ActiveCfg = Release|Any CPU
70+
{1D7E318C-D0F5-4713-A793-EE38AC2FDF00}.Release|x86.Build.0 = Release|Any CPU
3571
EndGlobalSection
3672
GlobalSection(SolutionProperties) = preSolution
3773
HideSolutionNode = FALSE
3874
EndGlobalSection
75+
GlobalSection(NestedProjects) = preSolution
76+
{1D7E318C-D0F5-4713-A793-EE38AC2FDF00} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
77+
EndGlobalSection
3978
GlobalSection(ExtensibilityGlobals) = postSolution
4079
SolutionGuid = {19B804F2-469A-40CA-9387-C9C1F7D231E8}
4180
EndGlobalSection

src/VisualStudio/Program.cs

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Devlooped;
1010

11-
class Program
11+
partial class Program
1212
{
1313
static readonly VersionChecker versionChecker = new();
1414

@@ -59,44 +59,51 @@ public Task CancelAsync()
5959

6060
public async Task<int> RunAsync()
6161
{
62-
if (preprocessor.IsTopLevelHelp(args))
63-
{
64-
ShowUsage();
65-
return 0;
66-
}
67-
68-
if (preprocessor.IsTopLevelVersion(args))
69-
{
70-
await ShowVersion();
71-
return 0;
72-
}
73-
7462
try
7563
{
76-
var processed = preprocessor.Process(args);
77-
var parseResult = rootCommand.Parse(processed);
64+
if (preprocessor.IsTopLevelHelp(args))
65+
{
66+
ShowUsage();
67+
return 0;
68+
}
7869

79-
var config = new InvocationConfiguration
70+
if (preprocessor.IsTopLevelVersion(args))
8071
{
81-
Output = output,
82-
Error = output,
83-
EnableDefaultExceptionHandler = false,
84-
};
72+
await ShowVersion();
73+
return 0;
74+
}
8575

86-
var exitCode = await parseResult.InvokeAsync(config, cts.Token);
76+
try
77+
{
78+
var processed = preprocessor.Process(args);
79+
var parseResult = rootCommand.Parse(processed);
80+
81+
var config = new InvocationConfiguration
82+
{
83+
Output = output,
84+
Error = output,
85+
EnableDefaultExceptionHandler = false,
86+
};
87+
88+
var exitCode = await parseResult.InvokeAsync(config, cts.Token);
89+
90+
// Help / non-success: do not run version update check (matches prior behavior).
91+
if (exitCode != 0 || parseResult.Action is HelpAction or ExamplesHelpAction)
92+
return exitCode;
93+
}
94+
catch (Exception ex) when (!SharedOptions.IsDebug(args))
95+
{
96+
output.WriteLine(ex.Message);
97+
return ErrorCodes.Error;
98+
}
8799

88-
// Help / non-success: do not run version update check (matches prior behavior).
89-
if (exitCode != 0 || parseResult.Action is HelpAction or ExamplesHelpAction)
90-
return exitCode;
100+
await versionChecker.ShowUpdateAsync(output);
101+
return 0;
91102
}
92-
catch (Exception ex) when (!SharedOptions.IsDebug(args))
103+
finally
93104
{
94-
output.WriteLine(ex.Message);
95-
return ErrorCodes.Error;
105+
WriteLegacyMigrationNotice(output);
96106
}
97-
98-
await versionChecker.ShowUpdateAsync(output);
99-
return 0;
100107
}
101108

102109
protected bool NoVersionChecks
@@ -119,4 +126,9 @@ protected virtual void ShowUsage()
119126
foreach (var command in commands)
120127
output.WriteLine($" {command.Name.GetNormalizedString(maxWidth)}{command.Description}");
121128
}
129+
130+
/// <summary>
131+
/// Optional post-run hook implemented by the legacy <c>dotnet-vs</c> package only.
132+
/// </summary>
133+
partial void WriteLegacyMigrationNotice(TextWriter output);
122134
}

src/dotnet-vs/LegacyNotice.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System;
2+
using System.IO;
3+
4+
namespace Devlooped;
5+
6+
partial class Program
7+
{
8+
partial void WriteLegacyMigrationNotice(TextWriter output)
9+
{
10+
var useColor = !Console.IsOutputRedirected && ReferenceEquals(output, Console.Out);
11+
12+
output.WriteLine();
13+
14+
if (useColor)
15+
Console.ForegroundColor = ConsoleColor.Yellow;
16+
17+
output.WriteLine("⚠ Package 'dotnet-vs' is obsolete.");
18+
19+
if (useColor)
20+
Console.ForegroundColor = ConsoleColor.Cyan;
21+
22+
output.WriteLine(" Use: dnx vs -- [command] [options]");
23+
24+
if (useColor)
25+
Console.ResetColor();
26+
27+
output.WriteLine();
28+
}
29+
}

src/dotnet-vs/dotnet-vs.csproj

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<Description>
5+
Legacy package id for the Visual Studio management tool.
6+
7+
This package is obsolete. Use `dnx vs` instead.
8+
9+
Usage: dnx vs -- [command] [options|-?|-h|--help] [--save=ALIAS [--global]]
10+
11+
See full documentation at $(PackageProjectUrl).
12+
</Description>
13+
14+
<OutputType>Exe</OutputType>
15+
<TargetFramework>net8.0</TargetFramework>
16+
<RollForward>Major</RollForward>
17+
18+
<AssemblyName>vs</AssemblyName>
19+
<RootNamespace>VisualStudio</RootNamespace>
20+
21+
<PackageId>dotnet-vs</PackageId>
22+
<PackageReadmeFile>readme.md</PackageReadmeFile>
23+
<PackageTags>dotnet tool visualstudio vs vswhere obsolete</PackageTags>
24+
25+
<ToolCommandName>vs</ToolCommandName>
26+
<PackAsTool>true</PackAsTool>
27+
28+
<NoWarn>$(NoWarn);NU5118</NoWarn>
29+
30+
<DateTime>$([System.DateTime]::UtcNow.ToString("yyyy-MM-dd"))</DateTime>
31+
32+
<!-- Avoid clashing with the main VisualStudio project intermediate/output under the same assembly name -->
33+
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
34+
<BaseOutputPath>bin\</BaseOutputPath>
35+
</PropertyGroup>
36+
37+
<ItemGroup>
38+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.300" PrivateAssets="all" />
39+
<PackageReference Include="System.CommandLine" Version="2.0.9" />
40+
<PackageReference Include="System.Text.Json" Version="10.0.9" />
41+
<PackageReference Include="vswhere" Version="3.1.7" PrivateAssets="all" />
42+
<PackageReference Include="ThisAssembly.AssemblyInfo" Version="2.1.2" PrivateAssets="all" />
43+
<PackageReference Include="ThisAssembly.Project" Version="2.1.2" PrivateAssets="all" />
44+
<PackageReference Include="System.Management" Version="10.0.9" />
45+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="5.3.0" />
46+
<PackageReference Include="DotNetConfig" Version="1.2.0" />
47+
<PackageReference Include="NuGetizer" Version="1.4.9" />
48+
</ItemGroup>
49+
50+
<ItemGroup>
51+
<Compile Include="..\VisualStudio\**\*.cs"
52+
Exclude="..\VisualStudio\obj\**;..\VisualStudio\bin\**"
53+
Link="%(RecursiveDir)%(Filename)%(Extension)" />
54+
<EmbeddedResource Include="..\VisualStudio\Docs\*.md" Link="Docs\%(Filename)%(Extension)" />
55+
<None Condition="'$(TargetFramework)' != ''"
56+
Include="$(VSWhereDir)vswhere.exe"
57+
Link="%(Filename)%(Extension)"
58+
CopyToOutputDirectory="PreserveNewest"
59+
Pack="true"
60+
PackagePath="tools\$(TargetFramework)\any\%(Filename)%(Extension)" />
61+
<None Include="readme.md" PackagePath="readme.md" Pack="true" />
62+
</ItemGroup>
63+
64+
<ItemGroup>
65+
<ProjectProperty Include="DateTime" />
66+
<ProjectProperty Include="RepositoryUrl" />
67+
</ItemGroup>
68+
69+
</Project>

src/dotnet-vs/readme.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
![Icon](https://raw.githubusercontent.com/devlooped/dotnet-vs/main/docs/img/icon-32.png) dotnet-vs
2+
============
3+
4+
[![Version](https://img.shields.io/nuget/v/dotnet-vs.svg?color=royalblue)](https://www.nuget.org/packages/dotnet-vs)
5+
[![Downloads](https://img.shields.io/nuget/dt/dotnet-vs.svg?color=darkmagenta)](https://www.nuget.org/packages/dotnet-vs)
6+
[![License](https://img.shields.io/github/license/devlooped/dotnet-vs.svg?color=blue)](https://github.com/devlooped/dotnet-vs/blob/master/license.txt)
7+
[![CI Status](https://github.com/devlooped/dotnet-vs/workflows/build/badge.svg?branch=main)](https://github.com/devlooped/dotnet-vs/actions?query=branch%3Amain+workflow%3Abuild+)
8+
[![CI Version](https://img.shields.io/endpoint?label=nuget.ci&color=brightgreen&url=https://shields.kzu.app/vpre/dotnet-vs/main)](https://pkg.kzu.app/index.json)
9+
10+
> [!IMPORTANT]
11+
> This package is obsolete. Use `dnx vs` instead.
12+
13+
This package id (`dotnet-vs`) is retained only for compatibility with existing
14+
`dotnet tool install -g dotnet-vs` installs. Prefer the `vs` package and run:
15+
16+
```
17+
dnx vs -- [command] [options]
18+
```
19+
20+
To get the CI version:
21+
22+
```
23+
dnx vs --prerelease --source https://pkg.kzu.app/index.json -- [command] [options]
24+
```
25+
26+
See the full documentation at [clarius.org/dotnet-vs](https://clarius.org/dotnet-vs).
27+
28+
---
29+
<!-- include https://github.com/devlooped/.github/raw/main/osmf.md -->
30+
## Open Source Maintenance Fee
31+
32+
To ensure the long-term sustainability of this project, users of this package who generate
33+
revenue must pay an [Open Source Maintenance Fee](https://opensourcemaintenancefee.org).
34+
While the source code is freely available under the terms of the [License](https://github.com/devlooped/dotnet-vs/blob/main/license.txt),
35+
this package and other aspects of the project require [adherence to the Maintenance Fee](https://github.com/devlooped/dotnet-vs/blob/main/osmfeula.txt).
36+
37+
To pay the Maintenance Fee, [become a Sponsor](https://github.com/sponsors/devlooped) at the proper
38+
OSMF tier. A single fee covers all of [Devlooped packages](https://www.nuget.org/profiles/Devlooped).
39+
40+
<!-- https://github.com/devlooped/.github/raw/main/osmf.md -->
41+
---
42+
<!-- include https://github.com/devlooped/sponsors/raw/main/footer.md -->
43+
# Sponsors
44+
45+
<!-- sponsors.md -->
46+
[![Clarius Org](https://avatars.githubusercontent.com/u/71888636?v=4&s=39 "Clarius Org")](https://github.com/clarius)
47+
[![MFB Technologies, Inc.](https://avatars.githubusercontent.com/u/87181630?v=4&s=39 "MFB Technologies, Inc.")](https://github.com/MFB-Technologies-Inc)
48+
[![SandRock](https://avatars.githubusercontent.com/u/321868?u=99e50a714276c43ae820632f1da88cb71632ec97&v=4&s=39 "SandRock")](https://github.com/sandrock)
49+
[![DRIVE.NET, Inc.](https://avatars.githubusercontent.com/u/15047123?v=4&s=39 "DRIVE.NET, Inc.")](https://github.com/drivenet)
50+
[![Keith Pickford](https://avatars.githubusercontent.com/u/16598898?u=64416b80caf7092a885f60bb31612270bffc9598&v=4&s=39 "Keith Pickford")](https://github.com/Keflon)
51+
[![Thomas Bolon](https://avatars.githubusercontent.com/u/127185?u=7f50babfc888675e37feb80851a4e9708f573386&v=4&s=39 "Thomas Bolon")](https://github.com/tbolon)
52+
[![Kori Francis](https://avatars.githubusercontent.com/u/67574?u=3991fb983e1c399edf39aebc00a9f9cd425703bd&v=4&s=39 "Kori Francis")](https://github.com/kfrancis)
53+
[![Reuben Swartz](https://avatars.githubusercontent.com/u/724704?u=2076fe336f9f6ad678009f1595cbea434b0c5a41&v=4&s=39 "Reuben Swartz")](https://github.com/rbnswartz)
54+
[![Jacob Foshee](https://avatars.githubusercontent.com/u/480334?v=4&s=39 "Jacob Foshee")](https://github.com/jfoshee)
55+
[![](https://avatars.githubusercontent.com/u/33566379?u=bf62e2b46435a267fa246a64537870fd2449410f&v=4&s=39 "")](https://github.com/Mrxx99)
56+
[![Eric Johnson](https://avatars.githubusercontent.com/u/26369281?u=41b560c2bc493149b32d384b960e0948c78767ab&v=4&s=39 "Eric Johnson")](https://github.com/eajhnsn1)
57+
[![Jonathan ](https://avatars.githubusercontent.com/u/5510103?u=98dcfbef3f32de629d30f1f418a095bf09e14891&v=4&s=39 "Jonathan ")](https://github.com/Jonathan-Hickey)
58+
[![Ken Bonny](https://avatars.githubusercontent.com/u/6417376?u=569af445b6f387917029ffb5129e9cf9f6f68421&v=4&s=39 "Ken Bonny")](https://github.com/KenBonny)
59+
[![Simon Cropp](https://avatars.githubusercontent.com/u/122666?v=4&s=39 "Simon Cropp")](https://github.com/SimonCropp)
60+
[![agileworks-eu](https://avatars.githubusercontent.com/u/5989304?v=4&s=39 "agileworks-eu")](https://github.com/agileworks-eu)
61+
[![Zheyu Shen](https://avatars.githubusercontent.com/u/4067473?v=4&s=39 "Zheyu Shen")](https://github.com/arsdragonfly)
62+
[![Vezel](https://avatars.githubusercontent.com/u/87844133?v=4&s=39 "Vezel")](https://github.com/vezel-dev)
63+
[![ChilliCream](https://avatars.githubusercontent.com/u/16239022?v=4&s=39 "ChilliCream")](https://github.com/ChilliCream)
64+
[![4OTC](https://avatars.githubusercontent.com/u/68428092?v=4&s=39 "4OTC")](https://github.com/4OTC)
65+
[![domischell](https://avatars.githubusercontent.com/u/66068846?u=0a5c5e2e7d90f15ea657bc660f175605935c5bea&v=4&s=39 "domischell")](https://github.com/DominicSchell)
66+
[![Adrian Alonso](https://avatars.githubusercontent.com/u/2027083?u=129cf516d99f5cb2fd0f4a0787a069f3446b7522&v=4&s=39 "Adrian Alonso")](https://github.com/adalon)
67+
[![torutek](https://avatars.githubusercontent.com/u/33917059?v=4&s=39 "torutek")](https://github.com/torutek)
68+
[![Ryan McCaffery](https://avatars.githubusercontent.com/u/16667079?u=c0daa64bb5c1b572130e05ae2b6f609ecc912d4d&v=4&s=39 "Ryan McCaffery")](https://github.com/mccaffers)
69+
[![Seika Logiciel](https://avatars.githubusercontent.com/u/2564602?v=4&s=39 "Seika Logiciel")](https://github.com/SeikaLogiciel)
70+
[![Andrew Grant](https://avatars.githubusercontent.com/devlooped-user?s=39 "Andrew Grant")](https://github.com/wizardness)
71+
[![eska-gmbh](https://avatars.githubusercontent.com/devlooped-team?s=39 "eska-gmbh")](https://github.com/eska-gmbh)
72+
[![Geodata AS](https://avatars.githubusercontent.com/u/5946299?v=4&s=39 "Geodata AS")](https://github.com/geodata-no)
73+
74+
75+
<!-- sponsors.md -->
76+
[![Sponsor this project](https://avatars.githubusercontent.com/devlooped-sponsor?s=118 "Sponsor this project")](https://github.com/sponsors/devlooped)
77+
78+
[Learn more about GitHub Sponsors](https://github.com/sponsors)
79+
80+
<!-- https://github.com/devlooped/sponsors/raw/main/footer.md -->

0 commit comments

Comments
 (0)