From 653f68866519705b5e532106cc6279efb8344799 Mon Sep 17 00:00:00 2001 From: Andy Zivkovic Date: Thu, 1 May 2025 10:29:33 +0930 Subject: [PATCH] Remove unused feature --- NuGet.sln | 7 - .../NuGet.VisualStudio.Client/.vsixignore | 1 - .../NuGet.VisualStudio.Client/.vsixinclude | 3 +- .../NuGet.VisualStudio.Client.csproj | 5 - .../source.extension.vsixmanifest | 2 - .../Directory.Build.targets | 4 - .../GlobalSuppressions.cs | 13 - .../GuidList.cs | 22 - .../Input/CommandGroup.cs | 17 - .../Input/PkgCmdIDList.cs | 11 - ...sualStudio.OnlineEnvironment.Client.csproj | 65 --- .../NuGetClientPackage.cs | 58 --- .../NuGetClientPackage.vsct | 108 ----- .../OnlineEnvironment.cs | 24 -- .../Properties/AssemblyInfo.cs | 29 -- .../Resources.Designer.cs | 72 ---- .../Resources.resx | 123 ------ .../SolutionExplorer/NuGetNodeExtender.cs | 49 --- .../NuGetWorkspaceCommandHandler.cs | 146 ------- .../PackageManagerUICommandHandler.cs | 405 ------------------ .../SolutionExplorer/RestoreCommandHandler.cs | 110 ----- 21 files changed, 1 insertion(+), 1273 deletions(-) delete mode 100644 src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Directory.Build.targets delete mode 100644 src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/GlobalSuppressions.cs delete mode 100644 src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/GuidList.cs delete mode 100644 src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Input/CommandGroup.cs delete mode 100644 src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Input/PkgCmdIDList.cs delete mode 100644 src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/NuGet.VisualStudio.OnlineEnvironment.Client.csproj delete mode 100644 src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/NuGetClientPackage.cs delete mode 100644 src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/NuGetClientPackage.vsct delete mode 100644 src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/OnlineEnvironment.cs delete mode 100644 src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Properties/AssemblyInfo.cs delete mode 100644 src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Resources.Designer.cs delete mode 100644 src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Resources.resx delete mode 100644 src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/SolutionExplorer/NuGetNodeExtender.cs delete mode 100644 src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/SolutionExplorer/NuGetWorkspaceCommandHandler.cs delete mode 100644 src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/SolutionExplorer/PackageManagerUICommandHandler.cs delete mode 100644 src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/SolutionExplorer/RestoreCommandHandler.cs diff --git a/NuGet.sln b/NuGet.sln index 1f8d79199a1..e69e23b6ed1 100644 --- a/NuGet.sln +++ b/NuGet.sln @@ -240,8 +240,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NuGet.Build.Tasks.Console", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NuGet.Build.Tasks.Console.Test", "test\NuGet.Core.Tests\NuGet.Build.Tasks.Console.Test\NuGet.Build.Tasks.Console.Test.csproj", "{2011B5A4-2184-4F94-9897-E5BC2425DCDA}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NuGet.VisualStudio.OnlineEnvironment.Client", "src\NuGet.Clients\NuGet.VisualStudio.OnlineEnvironment.Client\NuGet.VisualStudio.OnlineEnvironment.Client.csproj", "{290DB64D-74BA-45C5-BAC0-6E31A8AFD5CB}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NuGet.VisualStudio.Internal.Contracts", "src\NuGet.Clients\NuGet.VisualStudio.Internal.Contracts\NuGet.VisualStudio.Internal.Contracts.csproj", "{DEEBF1A1-1C21-4E9E-8CE3-1EB21381FF1E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NuGet.VisualStudio.Contracts", "src\NuGet.Clients\NuGet.VisualStudio.Contracts\NuGet.VisualStudio.Contracts.csproj", "{6AF72BEE-70F0-48B2-BD63-0E80D9747342}" @@ -645,10 +643,6 @@ Global {2011B5A4-2184-4F94-9897-E5BC2425DCDA}.Debug|Any CPU.Build.0 = Debug|Any CPU {2011B5A4-2184-4F94-9897-E5BC2425DCDA}.Release|Any CPU.ActiveCfg = Release|Any CPU {2011B5A4-2184-4F94-9897-E5BC2425DCDA}.Release|Any CPU.Build.0 = Release|Any CPU - {290DB64D-74BA-45C5-BAC0-6E31A8AFD5CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {290DB64D-74BA-45C5-BAC0-6E31A8AFD5CB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {290DB64D-74BA-45C5-BAC0-6E31A8AFD5CB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {290DB64D-74BA-45C5-BAC0-6E31A8AFD5CB}.Release|Any CPU.Build.0 = Release|Any CPU {DEEBF1A1-1C21-4E9E-8CE3-1EB21381FF1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DEEBF1A1-1C21-4E9E-8CE3-1EB21381FF1E}.Debug|Any CPU.Build.0 = Debug|Any CPU {DEEBF1A1-1C21-4E9E-8CE3-1EB21381FF1E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -806,7 +800,6 @@ Global {92EF44DB-4F40-4610-A1AD-3A554A0CA8B9} = {BB63CACA-866F-454F-BA4C-78B788D032BB} {3ED13630-90EB-420E-8083-0959B2955C6E} = {506AF844-92E0-4404-BBFC-0AB073890A72} {2011B5A4-2184-4F94-9897-E5BC2425DCDA} = {7323F93B-D141-4001-BB9E-7AF14031143E} - {290DB64D-74BA-45C5-BAC0-6E31A8AFD5CB} = {08F523EC-3C2A-4A00-A54C-2E54C5AC856B} {DEEBF1A1-1C21-4E9E-8CE3-1EB21381FF1E} = {08F523EC-3C2A-4A00-A54C-2E54C5AC856B} {6AF72BEE-70F0-48B2-BD63-0E80D9747342} = {08F523EC-3C2A-4A00-A54C-2E54C5AC856B} {C24DD62A-905D-4C48-A17A-B83107F17EA7} = {01BC4531-1E25-48D7-A8FD-A47D6FEC47FB} diff --git a/src/NuGet.Clients/NuGet.VisualStudio.Client/.vsixignore b/src/NuGet.Clients/NuGet.VisualStudio.Client/.vsixignore index 52bd6b300b7..53e57d866c8 100644 --- a/src/NuGet.Clients/NuGet.VisualStudio.Client/.vsixignore +++ b/src/NuGet.Clients/NuGet.VisualStudio.Client/.vsixignore @@ -129,5 +129,4 @@ NuGet.VisualStudio.Contracts.xml NuGet.VisualStudio.Implementation.xml NuGet.VisualStudio.Internal.Contracts.xml NuGet.VisualStudio.Interop.xml -NuGet.VisualStudio.OnlineEnvironment.Client.xml NuGet.VisualStudio.xml diff --git a/src/NuGet.Clients/NuGet.VisualStudio.Client/.vsixinclude b/src/NuGet.Clients/NuGet.VisualStudio.Client/.vsixinclude index 5bba64ef366..fabbfc00c51 100644 --- a/src/NuGet.Clients/NuGet.VisualStudio.Client/.vsixinclude +++ b/src/NuGet.Clients/NuGet.VisualStudio.Client/.vsixinclude @@ -10,7 +10,6 @@ NuGet.VisualStudio.Contracts.dll NuGet.VisualStudio.Implementation.dll NuGet.VisualStudio.Internal.Contracts.dll NuGet.VisualStudio.Interop.dll -NuGet.VisualStudio.OnlineEnvironment.Client.dll NuGet.VisualStudio.dll # MS delay signed assemblies @@ -38,4 +37,4 @@ Microsoft.Extensions.Primitives.dll Microsoft.Web.XmlTransform.dll # Assembly XML Documentation we ship in the VSIX -NuGet.PackageManagement.PowerShellCmdlets.dll-Help.xml \ No newline at end of file +NuGet.PackageManagement.PowerShellCmdlets.dll-Help.xml diff --git a/src/NuGet.Clients/NuGet.VisualStudio.Client/NuGet.VisualStudio.Client.csproj b/src/NuGet.Clients/NuGet.VisualStudio.Client/NuGet.VisualStudio.Client.csproj index 39c9187266f..e7a478b44ad 100644 --- a/src/NuGet.Clients/NuGet.VisualStudio.Client/NuGet.VisualStudio.Client.csproj +++ b/src/NuGet.Clients/NuGet.VisualStudio.Client/NuGet.VisualStudio.Client.csproj @@ -258,11 +258,6 @@ BuiltProjectOutputGroup DebugSymbolsProjectOutputGroup - - NuGet.VisualStudio.OnlineEnvironment.Client - BuiltProjectOutputGroup%3bPkgdefProjectOutputGroup%3bGetCopyToOutputDirectoryItems%3bBuiltProjectOutputGroupDependencies%3bGetCopyToOutputDirectoryItems%3bSatelliteDllsProjectOutputGroup%3b - DebugSymbolsProjectOutputGroup - diff --git a/src/NuGet.Clients/NuGet.VisualStudio.Client/source.extension.vsixmanifest b/src/NuGet.Clients/NuGet.VisualStudio.Client/source.extension.vsixmanifest index 7ae19586ffa..77017bc5d4e 100644 --- a/src/NuGet.Clients/NuGet.VisualStudio.Client/source.extension.vsixmanifest +++ b/src/NuGet.Clients/NuGet.VisualStudio.Client/source.extension.vsixmanifest @@ -51,7 +51,6 @@ - @@ -63,7 +62,6 @@ - diff --git a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Directory.Build.targets b/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Directory.Build.targets deleted file mode 100644 index b419d6a303a..00000000000 --- a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Directory.Build.targets +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/GlobalSuppressions.cs b/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/GlobalSuppressions.cs deleted file mode 100644 index f65f8aabd61..00000000000 --- a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/GlobalSuppressions.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -// This file is used by Code Analysis to maintain SuppressMessage -// attributes that are applied to this project. -// Project-level suppressions either have no target or are given -// a specific target and scoped to a namespace, type, member, etc. - -using System.Diagnostics.CodeAnalysis; - -[assembly: SuppressMessage("Build", "CA1031:Modify 'RunSolutionRestoreAsync' to catch a more specific allowed exception type, or rethrow the exception.", Justification = "", Scope = "member", Target = "~M:NuGet.VisualStudio.OnlineEnvironment.Client.RestoreCommandHandler.RunSolutionRestoreAsync~System.Threading.Tasks.Task")] -[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "", Scope = "member", Target = "~M:NuGet.VisualStudio.OnlineEnvironment.Client.PackageManagerUICommandHandler.IsPackageManagerUISupported(Microsoft.VisualStudio.Workspace.VSIntegration.UI.WorkspaceVisualNodeBase)~System.Boolean")] -[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "", Scope = "member", Target = "~M:NuGet.VisualStudio.OnlineEnvironment.Client.PackageManagerUICommandHandler.Search(Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame,System.String)")] diff --git a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/GuidList.cs b/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/GuidList.cs deleted file mode 100644 index 9dd6a75dfb8..00000000000 --- a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/GuidList.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; - -namespace NuGet.VisualStudio.OnlineEnvironment.Client -{ - internal static class GuidList - { - // NuGet Output window pane - public static Guid GuidNuGetOutputWindowPaneGuid = Guid.Parse("CEC55EC8-CC51-40E7-9243-57B87A6F6BEB"); - public static readonly Guid NuGetEditorType = Guid.Parse(NuGetEditorTypeString); - - // Unique identifier of the editor factory that created an instance of the document view and document data objects. - // Used when creating document windows of Package Manager - private const string NuGetEditorTypeString = "95501c48-a850-47c1-a785-2aaa96637f81"; - - // Online Environments in 16.4 - public const string CloudEnvironmentConnectedUIContextGuidString = "{CE73BF3D-D614-438A-9B93-24E9E9D7453A}"; - public static readonly Guid CloudEnvironmentConnectedUIContextGuid = new Guid(CloudEnvironmentConnectedUIContextGuidString); - } -} diff --git a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Input/CommandGroup.cs b/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Input/CommandGroup.cs deleted file mode 100644 index d117a8c3cd8..00000000000 --- a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Input/CommandGroup.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; - -namespace NuGet.VisualStudio.OnlineEnvironment.Client -{ - /// - /// Specifies the command groups handled in this project. - /// - internal static class CommandGroup - { - public const string NuGetOnlineEnvironmentsClientProjectCommandSet = "{282008cc-d0db-45e1-80d1-00fabac5de92}"; - - public static readonly Guid NuGetOnlineEnvironmentsClientProjectCommandSetGuid = Guid.Parse(NuGetOnlineEnvironmentsClientProjectCommandSet); - } -} diff --git a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Input/PkgCmdIDList.cs b/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Input/PkgCmdIDList.cs deleted file mode 100644 index a8dcdaa2cda..00000000000 --- a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Input/PkgCmdIDList.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace NuGet.VisualStudio.OnlineEnvironment.Client -{ - internal static class PkgCmdIDList - { - public const int CmdidRestorePackages = 0x0100; - public const int CmdIdManageProjectUI = 0x0200; - } -} diff --git a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/NuGet.VisualStudio.OnlineEnvironment.Client.csproj b/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/NuGet.VisualStudio.OnlineEnvironment.Client.csproj deleted file mode 100644 index c727da412b5..00000000000 --- a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/NuGet.VisualStudio.OnlineEnvironment.Client.csproj +++ /dev/null @@ -1,65 +0,0 @@ - - - true - true - $(NETFXTargetFramework) - true - true - true - false - false - true - true - false - false - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - True - True - Resources.resx - - - - - - Menus.ctmenu - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - - diff --git a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/NuGetClientPackage.cs b/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/NuGetClientPackage.cs deleted file mode 100644 index a1084fdc07f..00000000000 --- a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/NuGetClientPackage.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Threading; -using Microsoft.VisualStudio.Shell; -using NuGet.PackageManagement.UI; -using NuGet.VisualStudio.Telemetry; -using Task = System.Threading.Tasks.Task; - -namespace NuGet.VisualStudio.OnlineEnvironment.Client -{ - /// - /// This is the class that implements the package exposed by this assembly. - /// - /// - /// - /// The minimum requirement for a class to be considered a valid package for Visual Studio - /// is to implement the IVsPackage interface and register itself with the shell. - /// This package uses the helper classes defined inside the Managed Package Framework (MPF) - /// to do it: it derives from the Package class that provides the implementation of the - /// IVsPackage interface and uses the registration attributes defined in the framework to - /// register itself and its components with the shell. These attributes tell the pkgdef creation - /// utility what data to put into .pkgdef file. - /// - /// - /// To get loaded into VS, the package must be referred by <Asset Type="Microsoft.VisualStudio.VsPackage" ...> in .vsixmanifest file. - /// - /// - [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] - [Guid(PackageGuidString)] - [ProvideMenuResource("Menus.ctmenu", 1)] - [ProvideToolWindow(typeof(PackageManagerToolWindowPane), - Style = VsDockStyle.MDI, - MultiInstances = true, - DocumentLikeTool = true)] - public sealed class NuGetClientPackage : AsyncPackage - { - /// - /// NuGet.VisualStudio.OnlineEnvironments.NuGetClientPackage GUID string. - /// - public const string PackageGuidString = "c6017f14-048f-4e19-9073-654bb585a878"; - - /// - /// Initialization of the package; this method is called right after the package is sited, so this is the place - /// where you can put all the initialization code that rely on services provided by VisualStudio. - /// - /// A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down. - /// A provider for progress updates. - /// A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method. - protected override Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) - { - // When initialized asynchronously, the current thread may be a background thread at this point. - // Do any initialization that requires the UI thread after switching to the UI thread - NuGetVSTelemetryService.Initialize(); - - return Task.CompletedTask; - } - } -} diff --git a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/NuGetClientPackage.vsct b/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/NuGetClientPackage.vsct deleted file mode 100644 index 2daa1431c19..00000000000 --- a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/NuGetClientPackage.vsct +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/OnlineEnvironment.cs b/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/OnlineEnvironment.cs deleted file mode 100644 index c493b7442ad..00000000000 --- a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/OnlineEnvironment.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; - -namespace NuGet.VisualStudio.OnlineEnvironment.Client -{ - /// - /// Specifies various constant values needed in the online environment. - /// - internal static class OnlineEnvironment - { - /// - /// Name of the Solution Explorer view responsible for showing the contents of a - /// solution (as opposed to the contents of a folder). - /// - public const string LiveShareSolutionView = "LiveShareSolutionView"; - - /// - /// Guid indicating that the selected node in Solution Explorer is a project. - /// - public static readonly Guid SolutionViewProjectGuid = new Guid("F9806588-A88E-4429-8BFD-228795DB3894"); - } -} diff --git a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Properties/AssemblyInfo.cs b/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Properties/AssemblyInfo.cs deleted file mode 100644 index ea136b5fe29..00000000000 --- a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.VisualStudio.Shell; - -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Lucene.Net.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.Web.XmlTransform.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Newtonsoft.Json.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\NuGet.Commands.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\NuGet.Common.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\NuGet.Configuration.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\NuGet.Credentials.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\NuGet.DependencyResolver.Core.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\NuGet.Frameworks.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\NuGet.Indexing.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\NuGet.LibraryModel.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\NuGet.PackageManagement.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\NuGet.PackageManagement.UI.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\NuGet.PackageManagement.VisualStudio.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\NuGet.Packaging.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\NuGet.ProjectModel.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\NuGet.Protocol.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\NuGet.Resolver.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\NuGet.Versioning.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\NuGet.VisualStudio.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\NuGet.VisualStudio.Common.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\NuGet.VisualStudio.Internal.Contracts.dll")] -[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\NuGet.VisualStudio.OnlineEnvironment.Client.dll")] - diff --git a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Resources.Designer.cs b/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Resources.Designer.cs deleted file mode 100644 index 8657d8723c5..00000000000 --- a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Resources.Designer.cs +++ /dev/null @@ -1,72 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace NuGet.VisualStudio.OnlineEnvironment.Client { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NuGet.VisualStudio.OnlineEnvironment.Client.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to Package Manager. - /// - internal static string OutputConsolePaneName { - get { - return ResourceManager.GetString("OutputConsolePaneName", resourceCulture); - } - } - } -} diff --git a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Resources.resx b/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Resources.resx deleted file mode 100644 index 267f8640488..00000000000 --- a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/Resources.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Package Manager - - \ No newline at end of file diff --git a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/SolutionExplorer/NuGetNodeExtender.cs b/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/SolutionExplorer/NuGetNodeExtender.cs deleted file mode 100644 index 5d0e64619b6..00000000000 --- a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/SolutionExplorer/NuGetNodeExtender.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.ComponentModel.Composition; -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Threading; -using Microsoft.VisualStudio.Workspace.VSIntegration.UI; - -namespace NuGet.VisualStudio.OnlineEnvironment.Client -{ - /// - /// Extends the Solution Explorer in online environment scenarios by adding command handlers - /// - [ExportNodeExtender(OnlineEnvironment.LiveShareSolutionView)] - internal sealed class NuGetNodeExtender : INodeExtender - { - /// - /// The shared command handler for all nodes NuGet cares about. - /// - private readonly IWorkspaceCommandHandler _commandHandler; - - [ImportingConstructor] - public NuGetNodeExtender(JoinableTaskContext taskContext) : - this(taskContext, AsyncServiceProvider.GlobalProvider) - { - } - - public NuGetNodeExtender( - JoinableTaskContext taskContext, - IAsyncServiceProvider asyncServiceProvider) - { - _commandHandler = new NuGetWorkspaceCommandHandler(taskContext, asyncServiceProvider); - } - - public IChildrenSource ProvideChildren(WorkspaceVisualNodeBase parentNode) - { - return null; - } - - /// - /// Provides our for nodes representing - /// managed projects. - /// - public IWorkspaceCommandHandler ProvideCommandHandler(WorkspaceVisualNodeBase parentNode) - { - return _commandHandler; - } - } -} diff --git a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/SolutionExplorer/NuGetWorkspaceCommandHandler.cs b/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/SolutionExplorer/NuGetWorkspaceCommandHandler.cs deleted file mode 100644 index c3baaf075d4..00000000000 --- a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/SolutionExplorer/NuGetWorkspaceCommandHandler.cs +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Microsoft.VisualStudio; -using Microsoft.VisualStudio.OLE.Interop; -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Threading; -using Microsoft.VisualStudio.Workspace.VSIntegration.UI; - -namespace NuGet.VisualStudio.OnlineEnvironment.Client -{ - /// - /// Extends the Solution Explorer in online environment scenarios. - /// - internal class NuGetWorkspaceCommandHandler : IWorkspaceCommandHandler - { - private readonly RestoreCommandHandler _restoreCommandHandler; - private readonly PackageManagerUICommandHandler _packageManagerUICommandHandler; - - internal NuGetWorkspaceCommandHandler(JoinableTaskContext taskContext, IAsyncServiceProvider asyncServiceProvider) - { - if (taskContext == null) - { - throw new ArgumentNullException(nameof(taskContext)); - } - - _restoreCommandHandler = new RestoreCommandHandler(taskContext.Factory, asyncServiceProvider); - _packageManagerUICommandHandler = new PackageManagerUICommandHandler(taskContext.Factory, asyncServiceProvider); - } - - /// - /// The command handlers priority. If there are multiple handlers for a given node - /// then they are called in order of decreasing priority. - /// - public int Priority => 2000; - - /// - /// Whether or not this handler should be ignored when multiple nodes are selected. - /// - public bool IgnoreOnMultiselect => true; - - public int Exec(List selection, Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) - { - if (pguidCmdGroup == CommandGroup.NuGetOnlineEnvironmentsClientProjectCommandSetGuid) - { - var nCmdIDInt = (int)nCmdID; - - switch (nCmdIDInt) - { - case PkgCmdIDList.CmdidRestorePackages: - if (IsSolutionOnlySelection(selection)) - { - _restoreCommandHandler.RunSolutionRestore(); - return VSConstants.S_OK; - } - break; - case PkgCmdIDList.CmdIdManageProjectUI: - if (IsSupportedProjectSelection(selection)) - { - _packageManagerUICommandHandler.OpenPackageManagerUI(selection.Single()); - return VSConstants.S_OK; - } - break; - default: - break; - } - } - return (int)Constants.OLECMDERR_E_NOTSUPPORTED; - } - - public bool QueryStatus(List selection, Guid pguidCmdGroup, uint nCmdID, ref uint cmdf, ref string customTitle) - { - bool handled = false; - - if (pguidCmdGroup == CommandGroup.NuGetOnlineEnvironmentsClientProjectCommandSetGuid) - { - var nCmdIDInt = (int)nCmdID; - { - switch (nCmdIDInt) - { - case PkgCmdIDList.CmdidRestorePackages: - if (IsSolutionOnlySelection(selection)) - { - var isRestoreActionInProgress = _restoreCommandHandler.IsRestoreActionInProgress(); - cmdf = (uint)((isRestoreActionInProgress ? 0 : OLECMDF.OLECMDF_ENABLED) | OLECMDF.OLECMDF_SUPPORTED); - handled = true; - } - break; - case PkgCmdIDList.CmdIdManageProjectUI: - if (IsSupportedProjectSelection(selection)) - { - var isPackageManagerUISupported = _packageManagerUICommandHandler.IsPackageManagerUISupported(selection.Single()); - cmdf = (uint)(isPackageManagerUISupported ? - (OLECMDF.OLECMDF_ENABLED | OLECMDF.OLECMDF_SUPPORTED) : - OLECMDF.OLECMDF_INVISIBLE); - handled = true; - } - break; - default: - break; - } - } - } - return handled; - } - - private static bool IsSupportedProjectSelection(List selection) - { - if (selection != null && - selection.Count.Equals(1)) - { - // We support every item representing a project - // - we don't have the ability to do a capabilities check, because we don't have enough information. - string fileExtension; - try - { - fileExtension = Path.GetExtension(selection.Single().NodeMoniker); - } - catch (ArgumentException) - { - return false; - } - - if (fileExtension == null) - { - return false; - } - - // We do not know if the project is supported - return fileExtension.EndsWith("proj", StringComparison.OrdinalIgnoreCase); - } - return false; - } - - private static bool IsSolutionOnlySelection(List selection) - { - return selection != null && - selection.Count.Equals(1) && - selection.First().NodeMoniker.Equals(string.Empty, StringComparison.Ordinal); - } - } -} diff --git a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/SolutionExplorer/PackageManagerUICommandHandler.cs b/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/SolutionExplorer/PackageManagerUICommandHandler.cs deleted file mode 100644 index 707a395da8d..00000000000 --- a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/SolutionExplorer/PackageManagerUICommandHandler.cs +++ /dev/null @@ -1,405 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; -using System.Globalization; -using System.IO; -using System.Runtime.InteropServices; -using System.Threading; -using System.Threading.Tasks; -using EnvDTE; -using Microsoft; -using Microsoft.ServiceHub.Framework; -using Microsoft.VisualStudio; -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Shell.Interop; -using Microsoft.VisualStudio.Threading; -using Microsoft.VisualStudio.Workspace.VSIntegration.UI; -using NuGet.Configuration; -using NuGet.PackageManagement; -using NuGet.PackageManagement.UI; -using NuGet.PackageManagement.VisualStudio; -using NuGet.ProjectManagement; -using NuGet.VisualStudio.Common; -using NuGet.VisualStudio.Internal.Contracts; -using NuGet.VisualStudio.Telemetry; -using IAsyncServiceProvider = Microsoft.VisualStudio.Shell.IAsyncServiceProvider; -using Resx = NuGet.PackageManagement.UI.Resources; -using Task = System.Threading.Tasks.Task; -using vsShellInterop = Microsoft.VisualStudio.Shell.Interop; - -namespace NuGet.VisualStudio.OnlineEnvironment.Client -{ - internal class PackageManagerUICommandHandler - { - private const bool IsPackageManagerUISupportAvailable = true; - private readonly JoinableTaskFactory _joinableTaskFactory; - private readonly IAsyncServiceProvider _asyncServiceProvider; - - private AsyncLazy _vsMonitorSelection; - private vsShellInterop.IVsMonitorSelection VsMonitorSelection => ThreadHelper.JoinableTaskFactory.Run(_vsMonitorSelection.GetValueAsync); - - private DTE _dte; - private DTEEvents _dteEvents; - private const string F1KeywordValuePmUI = "VS.NuGet.PackageManager.UI"; - private uint _solutionExistsAndFullyLoadedContextCookie; - private uint _solutionNotBuildingAndNotDebuggingContextCookie; - private uint _solutionExistsCookie; - private uint _maxToolWindowId = 0; - private Dictionary _projectGuidToToolWindowId; - - private bool _initialized; - - public PackageManagerUICommandHandler(JoinableTaskFactory joinableTaskFactory, IAsyncServiceProvider asyncServiceProvider) - { - _joinableTaskFactory = joinableTaskFactory ?? throw new ArgumentNullException(nameof(joinableTaskFactory)); - _asyncServiceProvider = asyncServiceProvider ?? throw new ArgumentNullException(nameof(asyncServiceProvider)); - Initialize(); - } - - [Import] - private Lazy ConsoleStatus { get; set; } - - [Import] - private Lazy DeleteOnRestartManager { get; set; } - - [Import] - private Lazy OutputConsoleLogger { get; set; } - - [Import] - private Lazy ProjectContext { get; set; } - - [Import] - private Lazy Settings { get; set; } - - [Import] - private Lazy SolutionManager { get; set; } - - [Import] - private Lazy SolutionUserOptions { get; set; } - - /// - /// This initializes the IVSSourceControlTracker, even though SourceControlTracker is unused. - /// - [Import] - private Lazy SourceControlTracker { get; set; } - - [Import] - private Lazy UIFactory { get; set; } - - private IDisposable ProjectRetargetingHandler { get; set; } - - private IDisposable ProjectUpgradeHandler { get; set; } - - [Import] - private Lazy ServiceBrokerProvider { get; set; } - - [Import] - private Lazy NuGetExperimentationService { get; set; } - - private void Initialize() - { - _vsMonitorSelection = new AsyncLazy( - async () => - { - await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); - - // get the UI context cookie for the debugging mode - var vsMonitorSelection = await _asyncServiceProvider.GetServiceAsync(); - Assumes.Present(vsMonitorSelection); - - // get the solution not building and not debugging cookie - var guidCmdUI = VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_guid; - vsMonitorSelection.GetCmdUIContextCookie( - ref guidCmdUI, out _solutionExistsAndFullyLoadedContextCookie); - - guidCmdUI = VSConstants.UICONTEXT.SolutionExistsAndNotBuildingAndNotDebugging_guid; - vsMonitorSelection.GetCmdUIContextCookie( - ref guidCmdUI, out _solutionNotBuildingAndNotDebuggingContextCookie); - - guidCmdUI = VSConstants.UICONTEXT.SolutionExists_guid; - vsMonitorSelection.GetCmdUIContextCookie( - ref guidCmdUI, out _solutionExistsCookie); - - return vsMonitorSelection; - }, - ThreadHelper.JoinableTaskFactory); - _projectGuidToToolWindowId = new Dictionary(); - } - - public bool IsPackageManagerUISupported(WorkspaceVisualNodeBase workspaceVisualNodeBase) - { - if (workspaceVisualNodeBase is null) - { - return false; - } - return IsPackageManagerUISupportAvailable; - } - - public void OpenPackageManagerUI(WorkspaceVisualNodeBase workspaceVisualNodeBase) - { - _joinableTaskFactory.RunAsync(() => OpenPackageManagerUIAsync(workspaceVisualNodeBase)).PostOnFailure(nameof(PackageManagerUICommandHandler)); - } - - private async Task OpenPackageManagerUIAsync(WorkspaceVisualNodeBase workspaceVisualNodeBase) - { - await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); - await ShowPackageManagerUIAsync(workspaceVisualNodeBase); - } - - /// - /// Initialize all MEF imports for this package and also add required event handlers. - /// - private async Task InitializeMEFAsync() - { - _initialized = true; - - var componentModel = await _asyncServiceProvider.GetComponentModelAsync(); - Assumes.Present(componentModel); - componentModel.DefaultCompositionService.SatisfyImportsOnce(this); - var experimentationService = NuGetExperimentationService.Value; - await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); - - Brushes.LoadVsBrushes(experimentationService); - - _dte = await _asyncServiceProvider.GetDTEAsync(); - Assumes.Present(_dte); - - _dteEvents = _dte.Events.DTEEvents; - //_dteEvents.OnBeginShutdown += OnBeginShutDown; - - if (SolutionManager.Value.NuGetProjectContext == null) - { - SolutionManager.Value.NuGetProjectContext = ProjectContext.Value; - } - - // when NuGet loads, if the current solution has some package - // folders marked for deletion (because a previous uninstalltion didn't succeed), - // delete them now. - if (await SolutionManager.Value.IsSolutionOpenAsync()) - { - await DeleteOnRestartManager.Value.DeleteMarkedPackageDirectoriesAsync(ProjectContext.Value); - } - - //ProjectRetargetingHandler = new ProjectRetargetingHandler(_dte, SolutionManager.Value, this, componentModel); - //ProjectUpgradeHandler = new ProjectUpgradeHandler(this, SolutionManager.Value); - - SolutionUserOptions.Value.LoadSettings(); - } - - private async Task ShowPackageManagerUIAsync(WorkspaceVisualNodeBase workspaceVisualNodeBase) - { - await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); - - if (ShouldMEFBeInitialized()) - { - await InitializeMEFAsync(); - } - - IVsWindowFrame window = await CreateNewWindowFrameAsync(workspaceVisualNodeBase); - if (window != null) - { - Search(window, string.Empty); - window.Show(); - } - } - - private async Task CreateNewWindowFrameAsync(WorkspaceVisualNodeBase workspaceVisualNodeBase) - { - await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); - - // Find existing hierarchy and item id of the document window if it's already registered. - var rdt = await _asyncServiceProvider.GetServiceAsync(); - Assumes.Present(rdt); - IVsHierarchy hier; - uint itemId; - var docData = IntPtr.Zero; - int hr; - - try - { - uint cookie; - hr = rdt.FindAndLockDocument( - (uint)_VSRDTFLAGS.RDT_NoLock, - workspaceVisualNodeBase.NodeMoniker, - out hier, - out itemId, - out docData, - out cookie); - - if (hr != VSConstants.S_OK) - { - // the docuemnt window is not registered yet. So use the hierarchy from the current selection. - itemId = (uint)VSConstants.VSITEMID.Root; - } - } - finally - { - if (docData != IntPtr.Zero) - { - Marshal.Release(docData); - docData = IntPtr.Zero; - } - } - - return await CreateToolWindowAsync(workspaceVisualNodeBase, hier, itemId); - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "Caller's responsibility to dispose.")] - private async ValueTask CreateToolWindowAsync(WorkspaceVisualNodeBase workspaceVisualNodeBase, IVsHierarchy hier, uint itemId) - { - await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); - - if (!Guid.TryParse(IProjectContextInfoUtility.GetProjectGuidStringFromVslsQueryString(workspaceVisualNodeBase.VSSelectionMoniker), out Guid projectGuid)) - { - throw new InvalidOperationException(); - } - - IVsWindowFrame windowFrame = null; - - var uiShell = await _asyncServiceProvider.GetServiceAsync(); - Assumes.Present(uiShell); - - uint toolWindowId; - bool foundToolWindowId = _projectGuidToToolWindowId.TryGetValue(projectGuid.ToString(), out toolWindowId); - const uint FTW_none = 0; - - if (foundToolWindowId) - { - ErrorHandler.ThrowOnFailure( - uiShell.FindToolWindowEx( - FTW_none, //grfFTW - badly-documented enum value. - typeof(PackageManagerToolWindowPane).GUID, // rguidPersistenceSlot - toolWindowId, // dwToolWindowId - out windowFrame)); - - if (windowFrame != null) - { - ((IVsWindowFrame2)windowFrame).ActivateOwnerDockedWindow(); - } - else - { - _projectGuidToToolWindowId.Remove(projectGuid.ToString()); - } - } - - if (windowFrame == null) - { - IServiceBroker serviceBroker = await ServiceBrokerProvider.Value.GetAsync(); - IProjectContextInfo projectContextInfo = await IProjectContextInfoUtility.CreateAsync(serviceBroker, projectGuid.ToString(), CancellationToken.None); - INuGetUI uiController = await UIFactory.Value.CreateAsync(serviceBroker, projectContextInfo); - // This model takes ownership of --- and Dispose() responsibility for --- the INuGetUI instance. - var model = new PackageManagerModel(uiController, isSolution: false, editorFactoryGuid: GuidList.NuGetEditorType); - var control = await PackageManagerControl.CreateAsync(model, OutputConsoleLogger.Value, VsShellUtilities.ShutdownToken); - var caption = string.Format(CultureInfo.CurrentCulture, Resx.Label_NuGetWindowCaption, Path.GetFileNameWithoutExtension(workspaceVisualNodeBase.NodeMoniker)); - - int[] pfDefaultPosition = null; - - var windowPane = new PackageManagerToolWindowPane(control, projectGuid.ToString()); - ErrorHandler.ThrowOnFailure( - uiShell.CreateToolWindow( - (uint)__VSCREATETOOLWIN.CTW_fInitNew, - ++_maxToolWindowId, // dwToolWindowId - windowPane, // ToolWindowPane - Guid.Empty, // rclsidTool = GUID_NULL - typeof(PackageManagerToolWindowPane).GUID, // rguidPersistenceSlot - Guid.Empty, // reserved - do not use - GUID_NULL - null, // IServiceProvider - caption, - pfDefaultPosition, - out windowFrame)); - _projectGuidToToolWindowId.Add(projectGuid.ToString(), _maxToolWindowId); - windowPane.Closed += WindowPane_Closed; - - if (windowFrame != null) - { - WindowFrameHelper.AddF1HelpKeyword(windowFrame, keywordValue: F1KeywordValuePmUI); - WindowFrameHelper.DisableWindowAutoReopen(windowFrame); - WindowFrameHelper.DockToolWindow(windowFrame); - } - } - - return windowFrame; - } - - private void WindowPane_Closed(object sender, EventArgs e) - { - var windowPane = (PackageManagerToolWindowPane)sender; - _projectGuidToToolWindowId.Remove(windowPane.ProjectGuid); - windowPane.Closed -= WindowPane_Closed; - } - - private async Task FindExistingSolutionWindowFrameAsync() - { - await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); - - var uiShell = await _asyncServiceProvider.GetServiceAsync(); - foreach (var windowFrame in VsUtility.GetDocumentWindows(uiShell)) - { - object property; - var hr = windowFrame.GetProperty((int)__VSFPROPID.VSFPROPID_DocData, out property); - var packageManagerControl = VsUtility.GetPackageManagerControl(windowFrame); - if (hr == VSConstants.S_OK - && property is IVsSolution - && packageManagerControl != null) - { - return windowFrame; - } - } - - return null; - } - - private static string GetSearchText(string parameterString) - { - if (parameterString == null) - { - return null; - } - - // The parameterString looks like: - // "jquery /searchin:online" - // or just "jquery" - - parameterString = parameterString.Trim(); - var lastIndexOfSearchInSwitch = parameterString.LastIndexOf("/searchin:", StringComparison.OrdinalIgnoreCase); - - if (lastIndexOfSearchInSwitch == -1) - { - return parameterString; - } - return parameterString.Substring(0, lastIndexOfSearchInSwitch); - } - - /// - /// Search for packages using the searchText. - /// - /// A window frame that hosts the PackageManagerControl. - /// Search text. - // private void Search(System.Windows.Window windowFrame, string searchText) - private void Search(vsShellInterop.IVsWindowFrame windowFrame, string searchText) - { - ThreadHelper.ThrowIfNotOnUIThread(); - - if (string.IsNullOrWhiteSpace(searchText)) - { - return; - } - - var packageManagerControl = VsUtility.GetPackageManagerControl(windowFrame); - if (packageManagerControl != null) - { - packageManagerControl.Search(searchText); - } - } - - private bool ShouldMEFBeInitialized() - { - ThreadHelper.ThrowIfNotOnUIThread(); - - return !_initialized; - } - } -} diff --git a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/SolutionExplorer/RestoreCommandHandler.cs b/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/SolutionExplorer/RestoreCommandHandler.cs deleted file mode 100644 index ae4e2e0094a..00000000000 --- a/src/NuGet.Clients/NuGet.VisualStudio.OnlineEnvironment.Client/SolutionExplorer/RestoreCommandHandler.cs +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.ServiceHub.Framework; -using Microsoft.VisualStudio; -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Shell.Interop; -using Microsoft.VisualStudio.Threading; -using NuGet.VisualStudio.Internal.Contracts; -using NuGet.VisualStudio.Telemetry; -using IAsyncServiceProvider = Microsoft.VisualStudio.Shell.IAsyncServiceProvider; -using SB = Microsoft.VisualStudio.Shell.ServiceBroker; -using Task = System.Threading.Tasks.Task; - -namespace NuGet.VisualStudio.OnlineEnvironment.Client -{ - internal class RestoreCommandHandler - { - private readonly JoinableTaskFactory _joinableTaskFactory; - private readonly IAsyncServiceProvider _asyncServiceProvider; - private CancellationTokenSource _cancelBuildToken; - - public RestoreCommandHandler(JoinableTaskFactory joinableTaskFactory, IAsyncServiceProvider asyncServiceProvider) - { - _joinableTaskFactory = joinableTaskFactory ?? throw new ArgumentNullException(nameof(joinableTaskFactory)); - _asyncServiceProvider = asyncServiceProvider ?? throw new ArgumentNullException(nameof(asyncServiceProvider)); - } - - public void RunSolutionRestore() - { - _joinableTaskFactory.RunAsync(RunSolutionRestoreAsync).PostOnFailure(nameof(RestoreCommandHandler)); - } - - private async Task RunSolutionRestoreAsync() - { - var cancellationTokenSource = new CancellationTokenSource(); - _cancelBuildToken = cancellationTokenSource; - - try - { - await GetAndActivatePackageManagerOutputWindowAsync(); - - await TaskScheduler.Default; - SB.IBrokeredServiceContainer serviceContainer = await _asyncServiceProvider.GetServiceAsync(); - IServiceBroker serviceBroker = serviceContainer.GetFullAccessServiceBroker(); - - INuGetSolutionService nugetSolutionService = await serviceBroker.GetProxyAsync(NuGetServices.SolutionService); - - try - { - await nugetSolutionService.RestoreSolutionAsync(cancellationTokenSource.Token); - } - finally - { - (nugetSolutionService as IDisposable)?.Dispose(); - } - } - catch (Exception e) - { - // Only log to the activity log for now - // TODO: https://github.com/NuGet/Home/issues/9352 - ActivityLog.LogError("NuGet Package Manager", e.Message); - } - finally - { - cancellationTokenSource.Dispose(); - _cancelBuildToken = null; - } - } - - public bool IsRestoreActionInProgress() - { - return _cancelBuildToken != null; - } - - private async Task GetAndActivatePackageManagerOutputWindowAsync() - { - var outputWindow = await _asyncServiceProvider.GetServiceAsync(); - var vsUIShell = await _asyncServiceProvider.GetServiceAsync(); - - await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); - - // create the Package Manager pane within the Output window - var hr = outputWindow.CreatePane( - ref GuidList.GuidNuGetOutputWindowPaneGuid, - Resources.OutputConsolePaneName, - fInitVisible: 1, - fClearWithSolution: 0); - ErrorHandler.ThrowOnFailure(hr); - - IVsOutputWindowPane pane; - hr = outputWindow.GetPane( - ref GuidList.GuidNuGetOutputWindowPaneGuid, - out pane); - ErrorHandler.ThrowOnFailure(hr); - - Guid outputToolWindow = VSConstants.StandardToolWindows.Output; - - vsUIShell.FindToolWindow(0, - ref outputToolWindow, - out var toolWindow); - toolWindow?.Show(); - - pane.Activate(); - } - } -}