diff --git a/src/Coree.VisualStudio.DotnetToolbar/CommandBase.cs b/src/Coree.VisualStudio.DotnetToolbar/CommandBase.cs
index da205a2..e42e6a1 100644
--- a/src/Coree.VisualStudio.DotnetToolbar/CommandBase.cs
+++ b/src/Coree.VisualStudio.DotnetToolbar/CommandBase.cs
@@ -137,9 +137,13 @@ internal virtual async System.Threading.Tasks.Task ExecuteAsync(object sender, E
CommandSettings.Instance.MenuItem.Enabled = false;
CommandDeleteBinObj.Instance.MenuItem.Enabled = false;
CommandDotnetTest.Instance.MenuItem.Enabled = false;
+ CommandDotnetGlobalJson6.Instance.MenuItem.Enabled = false;
+ CommandDotnetGlobalJson7.Instance.MenuItem.Enabled = false;
+ CommandDotnetGlobalJson8.Instance.MenuItem.Enabled = false;
+ CommandDotnetExperimentalTest.Instance.MenuItem.Enabled = false;
await StartDotNetProcessAsync();
-
+
CommandDotnetBuild.Instance.MenuItem.Enabled = true;
CommandDotnetPack.Instance.MenuItem.Enabled = true;
CommandDotnetPublish.Instance.MenuItem.Enabled = true;
@@ -148,6 +152,10 @@ internal virtual async System.Threading.Tasks.Task ExecuteAsync(object sender, E
CommandSettings.Instance.MenuItem.Enabled = true;
CommandDeleteBinObj.Instance.MenuItem.Enabled = true;
CommandDotnetTest.Instance.MenuItem.Enabled = true;
+ CommandDotnetGlobalJson6.Instance.MenuItem.Enabled = true;
+ CommandDotnetGlobalJson7.Instance.MenuItem.Enabled = true;
+ CommandDotnetGlobalJson8.Instance.MenuItem.Enabled = true;
+ CommandDotnetExperimentalTest.Instance.MenuItem.Enabled = true;
}
internal virtual async Task StartDotNetProcessAsync()
diff --git a/src/Coree.VisualStudio.DotnetToolbar/CommandDotnetExperimentalTest.cs b/src/Coree.VisualStudio.DotnetToolbar/CommandDotnetExperimentalTest.cs
new file mode 100644
index 0000000..946917a
--- /dev/null
+++ b/src/Coree.VisualStudio.DotnetToolbar/CommandDotnetExperimentalTest.cs
@@ -0,0 +1,155 @@
+using Coree.VisualStudio.DotnetToolbar.ExtensionMethods;
+using EnvDTE;
+using EnvDTE80;
+using Microsoft.VisualStudio.Shell;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Design;
+using System.Linq;
+using static Microsoft.VisualStudio.Shell.ThreadedWaitDialogHelper;
+
+namespace Coree.VisualStudio.DotnetToolbar
+{
+ ///
+ /// Command handler
+ ///
+ internal sealed class CommandDotnetExperimentalTest : CommandBase
+ {
+ ///
+ /// Command ID.
+ ///
+ public const int CommandId = 5152;
+
+ ///
+ /// Command menu group (command set GUID).
+ ///
+ public static readonly Guid CommandSet = new Guid("7303216a-a2cb-4519-b645-a34ae1380a78");
+
+ internal readonly MenuCommand MenuItem;
+
+ ///
+ /// Initializes a new instance of the class.
+ /// Adds our command handlers for menu (commands must exist in the command table file)
+ ///
+ /// Owner package, not null.
+ /// Command service to add command to, not null.
+ private CommandDotnetExperimentalTest(AsyncPackage package, OleMenuCommandService commandService) : base(package, commandService)
+ {
+ CommandID menuCommandID = new CommandID(CommandSet, CommandId);
+#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
+#pragma warning disable VSTHRD110 // Observe result of async calls
+ MenuItem = new MenuCommand((s, e) => ExecuteAsync(s, e), menuCommandID);
+ MenuItem.Enabled = false;
+#pragma warning restore VSTHRD110 // Observe result of async calls
+#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
+
+ commandService.AddCommand(MenuItem);
+ }
+
+ ///
+ /// Gets the instance of the command.
+ ///
+ public static CommandDotnetExperimentalTest Instance
+ {
+ get;
+ private set;
+ }
+
+ ///
+ /// Initializes the singleton instance of the command.
+ ///
+ /// Owner package, not null.
+ public static async System.Threading.Tasks.Task InitializeAsync(AsyncPackage package)
+ {
+ // Switch to the main thread - the call to AddCommand in Command3's constructor requires
+ // the UI thread.
+ await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);
+
+ OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;
+ Instance = new CommandDotnetExperimentalTest(package, commandService);
+ }
+
+ ///
+ /// This function is the callback used to execute the command when the menu item is clicked.
+ /// See the constructor to see how the menu item is associated with this function using
+ /// OleMenuCommandService service and MenuCommand class.
+ ///
+ /// Event sender.
+ /// Event args.
+ /*
+ internal override async System.Threading.Tasks.Task ExecuteAsync(object sender, EventArgs e)
+ {
+ CommandDotnetBuild.Instance.MenuItem.Enabled = false;
+ CommandDotnetPack.Instance.MenuItem.Enabled = false;
+ CommandDotnetPublish.Instance.MenuItem.Enabled = false;
+ CommandDotnetNugetPush.Instance.MenuItem.Enabled = false;
+ CommandDotnetClean.Instance.MenuItem.Enabled = false;
+ CommandSettings.Instance.MenuItem.Enabled = false;
+ CommandDeleteBinObj.Instance.MenuItem.Enabled = false;
+
+ await StartDotNetProcessAsync();
+
+ CommandDotnetBuild.Instance.MenuItem.Enabled = true;
+ CommandDotnetPack.Instance.MenuItem.Enabled = true;
+ CommandDotnetPublish.Instance.MenuItem.Enabled = true;
+ CommandDotnetNugetPush.Instance.MenuItem.Enabled = true;
+ CommandDotnetClean.Instance.MenuItem.Enabled = true;
+ CommandSettings.Instance.MenuItem.Enabled = true;
+ CommandDeleteBinObj.Instance.MenuItem.Enabled = true;
+ }
+ */
+
+ internal override async System.Threading.Tasks.Task StartDotNetProcessAsync()
+ {
+ await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(Package.DisposalToken);
+ DTE2 dte2 = (DTE2)await ServiceProvider.GetServiceAsync(typeof(DTE)).ConfigureAwait(false);
+
+ await WindowActivateAsync(EnvDTE.Constants.vsWindowKindOutput);
+
+ var activeConfiguration = await GetActiveSolutionConfigurationAsync();
+ if (activeConfiguration == null)
+ {
+ await PaneWriteLineAsync("Can't not determinate a active solution configuration.");
+ return;
+ }
+
+ string slnfile = await GetSolutionFileNameAsync();
+ string slndir = System.IO.Path.GetDirectoryName(slnfile);
+
+ await PaneClearAsync();
+
+ if (CoreeVisualStudioDotnetToolbarPackage.Instance.Settings.SolutionSettingsGeneral.KillAllDotnetProcessBeforeExectue)
+ {
+ (new System.Diagnostics.Process()).AllDontNetKill("dotnet");
+ }
+
+ List projectInfos = new List();
+
+ if (CoreeVisualStudioDotnetToolbarPackage.Instance.Settings.SolutionSettingsGeneral.BlockNonSdkExecute)
+ {
+ projectInfos = (await GetProjectInfosAsync()).Where(e => e.SolutionDirectoryItemNameLocationExists == true).ToList();
+
+ bool found = false;
+ foreach (var item in projectInfos)
+ {
+ if (item.IsSdkStyle == false)
+ {
+ await PaneWriteLineAsync("-------------------------------------------------------------------------------");
+ await PaneWriteLineAsync($"Non SDK style project file {item.VSProjectLocation} !");
+ await PaneWriteLineAsync("-------------------------------------------------------------------------------");
+ found = true;
+ }
+ }
+ if (found)
+ {
+ await PaneWriteLineAsync("Done");
+ return;
+ }
+ }
+
+ await ExecuteProcessAsync("dotnet.exe", $@"--version", $@"{slndir}");
+
+ await PaneWriteLineAsync("Done");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Coree.VisualStudio.DotnetToolbar/CommandDotnetGlobalJson6.cs b/src/Coree.VisualStudio.DotnetToolbar/CommandDotnetGlobalJson6.cs
new file mode 100644
index 0000000..927a76c
--- /dev/null
+++ b/src/Coree.VisualStudio.DotnetToolbar/CommandDotnetGlobalJson6.cs
@@ -0,0 +1,126 @@
+using Coree.VisualStudio.DotnetToolbar.ExtensionMethods;
+using EnvDTE;
+using EnvDTE80;
+using Microsoft.VisualStudio.Shell;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Design;
+using System.Linq;
+using static Microsoft.VisualStudio.Shell.ThreadedWaitDialogHelper;
+
+namespace Coree.VisualStudio.DotnetToolbar
+{
+ ///
+ /// Command handler
+ ///
+ internal sealed class CommandDotnetGlobalJson6 : CommandBase
+ {
+ ///
+ /// Command ID.
+ ///
+ public const int CommandId = 5149;
+
+ ///
+ /// Command menu group (command set GUID).
+ ///
+ public static readonly Guid CommandSet = new Guid("7303216a-a2cb-4519-b645-a34ae1380a78");
+
+ internal readonly MenuCommand MenuItem;
+
+ ///
+ /// Initializes a new instance of the class.
+ /// Adds our command handlers for menu (commands must exist in the command table file)
+ ///
+ /// Owner package, not null.
+ /// Command service to add command to, not null.
+ private CommandDotnetGlobalJson6(AsyncPackage package, OleMenuCommandService commandService) : base(package, commandService)
+ {
+ CommandID menuCommandID = new CommandID(CommandSet, CommandId);
+#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
+#pragma warning disable VSTHRD110 // Observe result of async calls
+ MenuItem = new MenuCommand((s, e) => ExecuteAsync(s, e), menuCommandID);
+ MenuItem.Enabled = false;
+#pragma warning restore VSTHRD110 // Observe result of async calls
+#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
+
+ commandService.AddCommand(MenuItem);
+ }
+
+ ///
+ /// Gets the instance of the command.
+ ///
+ public static CommandDotnetGlobalJson6 Instance
+ {
+ get;
+ private set;
+ }
+
+ ///
+ /// Initializes the singleton instance of the command.
+ ///
+ /// Owner package, not null.
+ public static async System.Threading.Tasks.Task InitializeAsync(AsyncPackage package)
+ {
+ // Switch to the main thread - the call to AddCommand in Command3's constructor requires
+ // the UI thread.
+ await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);
+
+ OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;
+ Instance = new CommandDotnetGlobalJson6(package, commandService);
+ }
+
+ internal override async System.Threading.Tasks.Task StartDotNetProcessAsync()
+ {
+ await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(Package.DisposalToken);
+ DTE2 dte2 = (DTE2)await ServiceProvider.GetServiceAsync(typeof(DTE)).ConfigureAwait(false);
+
+ await WindowActivateAsync(EnvDTE.Constants.vsWindowKindOutput);
+
+ var activeConfiguration = await GetActiveSolutionConfigurationAsync();
+ if (activeConfiguration == null)
+ {
+ await PaneWriteLineAsync("Can't not determinate a active solution configuration.");
+ return;
+ }
+
+ string slnfile = await GetSolutionFileNameAsync();
+ string slndir = System.IO.Path.GetDirectoryName(slnfile);
+
+ await PaneClearAsync();
+
+ if (CoreeVisualStudioDotnetToolbarPackage.Instance.Settings.SolutionSettingsGeneral.KillAllDotnetProcessBeforeExectue)
+ {
+ (new System.Diagnostics.Process()).AllDontNetKill("dotnet");
+ }
+
+ List projectInfos = new List();
+
+ if (CoreeVisualStudioDotnetToolbarPackage.Instance.Settings.SolutionSettingsGeneral.BlockNonSdkExecute)
+ {
+ projectInfos = (await GetProjectInfosAsync()).Where(e => e.SolutionDirectoryItemNameLocationExists == true).ToList();
+
+ bool found = false;
+ foreach (var item in projectInfos)
+ {
+ if (item.IsSdkStyle == false)
+ {
+ await PaneWriteLineAsync("-------------------------------------------------------------------------------");
+ await PaneWriteLineAsync($"Non SDK style project file {item.VSProjectLocation} !");
+ await PaneWriteLineAsync("-------------------------------------------------------------------------------");
+ found = true;
+ }
+ }
+ if (found)
+ {
+ await PaneWriteLineAsync("Done");
+ return;
+ }
+ }
+
+ await ExecuteProcessAsync("dotnet.exe", $@"--version", $@"{slndir}");
+ await ExecuteProcessAsync("dotnet.exe", $@"new globaljson --force --sdk-version 6.0.0 --roll-forward=latestFeature", $@"{slndir}");
+
+ await PaneWriteLineAsync("Done");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Coree.VisualStudio.DotnetToolbar/CommandDotnetGlobalJson7.cs b/src/Coree.VisualStudio.DotnetToolbar/CommandDotnetGlobalJson7.cs
new file mode 100644
index 0000000..4608207
--- /dev/null
+++ b/src/Coree.VisualStudio.DotnetToolbar/CommandDotnetGlobalJson7.cs
@@ -0,0 +1,156 @@
+using Coree.VisualStudio.DotnetToolbar.ExtensionMethods;
+using EnvDTE;
+using EnvDTE80;
+using Microsoft.VisualStudio.Shell;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Design;
+using System.Linq;
+using static Microsoft.VisualStudio.Shell.ThreadedWaitDialogHelper;
+
+namespace Coree.VisualStudio.DotnetToolbar
+{
+ ///
+ /// Command handler
+ ///
+ internal sealed class CommandDotnetGlobalJson7 : CommandBase
+ {
+ ///
+ /// Command ID.
+ ///
+ public const int CommandId = 5150;
+
+ ///
+ /// Command menu group (command set GUID).
+ ///
+ public static readonly Guid CommandSet = new Guid("7303216a-a2cb-4519-b645-a34ae1380a78");
+
+ internal readonly MenuCommand MenuItem;
+
+ ///
+ /// Initializes a new instance of the class.
+ /// Adds our command handlers for menu (commands must exist in the command table file)
+ ///
+ /// Owner package, not null.
+ /// Command service to add command to, not null.
+ private CommandDotnetGlobalJson7(AsyncPackage package, OleMenuCommandService commandService) : base(package, commandService)
+ {
+ CommandID menuCommandID = new CommandID(CommandSet, CommandId);
+#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
+#pragma warning disable VSTHRD110 // Observe result of async calls
+ MenuItem = new MenuCommand((s, e) => ExecuteAsync(s, e), menuCommandID);
+ MenuItem.Enabled = false;
+#pragma warning restore VSTHRD110 // Observe result of async calls
+#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
+
+ commandService.AddCommand(MenuItem);
+ }
+
+ ///
+ /// Gets the instance of the command.
+ ///
+ public static CommandDotnetGlobalJson7 Instance
+ {
+ get;
+ private set;
+ }
+
+ ///
+ /// Initializes the singleton instance of the command.
+ ///
+ /// Owner package, not null.
+ public static async System.Threading.Tasks.Task InitializeAsync(AsyncPackage package)
+ {
+ // Switch to the main thread - the call to AddCommand in Command3's constructor requires
+ // the UI thread.
+ await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);
+
+ OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;
+ Instance = new CommandDotnetGlobalJson7(package, commandService);
+ }
+
+ ///
+ /// This function is the callback used to execute the command when the menu item is clicked.
+ /// See the constructor to see how the menu item is associated with this function using
+ /// OleMenuCommandService service and MenuCommand class.
+ ///
+ /// Event sender.
+ /// Event args.
+ /*
+ internal override async System.Threading.Tasks.Task ExecuteAsync(object sender, EventArgs e)
+ {
+ CommandDotnetBuild.Instance.MenuItem.Enabled = false;
+ CommandDotnetPack.Instance.MenuItem.Enabled = false;
+ CommandDotnetPublish.Instance.MenuItem.Enabled = false;
+ CommandDotnetNugetPush.Instance.MenuItem.Enabled = false;
+ CommandDotnetClean.Instance.MenuItem.Enabled = false;
+ CommandSettings.Instance.MenuItem.Enabled = false;
+ CommandDeleteBinObj.Instance.MenuItem.Enabled = false;
+
+ await StartDotNetProcessAsync();
+
+ CommandDotnetBuild.Instance.MenuItem.Enabled = true;
+ CommandDotnetPack.Instance.MenuItem.Enabled = true;
+ CommandDotnetPublish.Instance.MenuItem.Enabled = true;
+ CommandDotnetNugetPush.Instance.MenuItem.Enabled = true;
+ CommandDotnetClean.Instance.MenuItem.Enabled = true;
+ CommandSettings.Instance.MenuItem.Enabled = true;
+ CommandDeleteBinObj.Instance.MenuItem.Enabled = true;
+ }
+ */
+
+ internal override async System.Threading.Tasks.Task StartDotNetProcessAsync()
+ {
+ await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(Package.DisposalToken);
+ DTE2 dte2 = (DTE2)await ServiceProvider.GetServiceAsync(typeof(DTE)).ConfigureAwait(false);
+
+ await WindowActivateAsync(EnvDTE.Constants.vsWindowKindOutput);
+
+ var activeConfiguration = await GetActiveSolutionConfigurationAsync();
+ if (activeConfiguration == null)
+ {
+ await PaneWriteLineAsync("Can't not determinate a active solution configuration.");
+ return;
+ }
+
+ string slnfile = await GetSolutionFileNameAsync();
+ string slndir = System.IO.Path.GetDirectoryName(slnfile);
+
+ await PaneClearAsync();
+
+ if (CoreeVisualStudioDotnetToolbarPackage.Instance.Settings.SolutionSettingsGeneral.KillAllDotnetProcessBeforeExectue)
+ {
+ (new System.Diagnostics.Process()).AllDontNetKill("dotnet");
+ }
+
+ List projectInfos = new List();
+
+ if (CoreeVisualStudioDotnetToolbarPackage.Instance.Settings.SolutionSettingsGeneral.BlockNonSdkExecute)
+ {
+ projectInfos = (await GetProjectInfosAsync()).Where(e => e.SolutionDirectoryItemNameLocationExists == true).ToList();
+
+ bool found = false;
+ foreach (var item in projectInfos)
+ {
+ if (item.IsSdkStyle == false)
+ {
+ await PaneWriteLineAsync("-------------------------------------------------------------------------------");
+ await PaneWriteLineAsync($"Non SDK style project file {item.VSProjectLocation} !");
+ await PaneWriteLineAsync("-------------------------------------------------------------------------------");
+ found = true;
+ }
+ }
+ if (found)
+ {
+ await PaneWriteLineAsync("Done");
+ return;
+ }
+ }
+
+ await ExecuteProcessAsync("dotnet.exe", $@"--version", $@"{slndir}");
+ await ExecuteProcessAsync("dotnet.exe", $@"new globaljson --force --sdk-version 7.0.0 --roll-forward=latestFeature", $@"{slndir}");
+
+ await PaneWriteLineAsync("Done");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Coree.VisualStudio.DotnetToolbar/CommandDotnetGlobalJson8.cs b/src/Coree.VisualStudio.DotnetToolbar/CommandDotnetGlobalJson8.cs
new file mode 100644
index 0000000..d910572
--- /dev/null
+++ b/src/Coree.VisualStudio.DotnetToolbar/CommandDotnetGlobalJson8.cs
@@ -0,0 +1,156 @@
+using Coree.VisualStudio.DotnetToolbar.ExtensionMethods;
+using EnvDTE;
+using EnvDTE80;
+using Microsoft.VisualStudio.Shell;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Design;
+using System.Linq;
+using static Microsoft.VisualStudio.Shell.ThreadedWaitDialogHelper;
+
+namespace Coree.VisualStudio.DotnetToolbar
+{
+ ///
+ /// Command handler
+ ///
+ internal sealed class CommandDotnetGlobalJson8 : CommandBase
+ {
+ ///
+ /// Command ID.
+ ///
+ public const int CommandId = 5151;
+
+ ///
+ /// Command menu group (command set GUID).
+ ///
+ public static readonly Guid CommandSet = new Guid("7303216a-a2cb-4519-b645-a34ae1380a78");
+
+ internal readonly MenuCommand MenuItem;
+
+ ///
+ /// Initializes a new instance of the class.
+ /// Adds our command handlers for menu (commands must exist in the command table file)
+ ///
+ /// Owner package, not null.
+ /// Command service to add command to, not null.
+ private CommandDotnetGlobalJson8(AsyncPackage package, OleMenuCommandService commandService) : base(package, commandService)
+ {
+ CommandID menuCommandID = new CommandID(CommandSet, CommandId);
+#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
+#pragma warning disable VSTHRD110 // Observe result of async calls
+ MenuItem = new MenuCommand((s, e) => ExecuteAsync(s, e), menuCommandID);
+ MenuItem.Enabled = false;
+#pragma warning restore VSTHRD110 // Observe result of async calls
+#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
+
+ commandService.AddCommand(MenuItem);
+ }
+
+ ///
+ /// Gets the instance of the command.
+ ///
+ public static CommandDotnetGlobalJson8 Instance
+ {
+ get;
+ private set;
+ }
+
+ ///
+ /// Initializes the singleton instance of the command.
+ ///
+ /// Owner package, not null.
+ public static async System.Threading.Tasks.Task InitializeAsync(AsyncPackage package)
+ {
+ // Switch to the main thread - the call to AddCommand in Command3's constructor requires
+ // the UI thread.
+ await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);
+
+ OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;
+ Instance = new CommandDotnetGlobalJson8(package, commandService);
+ }
+
+ ///
+ /// This function is the callback used to execute the command when the menu item is clicked.
+ /// See the constructor to see how the menu item is associated with this function using
+ /// OleMenuCommandService service and MenuCommand class.
+ ///
+ /// Event sender.
+ /// Event args.
+ /*
+ internal override async System.Threading.Tasks.Task ExecuteAsync(object sender, EventArgs e)
+ {
+ CommandDotnetBuild.Instance.MenuItem.Enabled = false;
+ CommandDotnetPack.Instance.MenuItem.Enabled = false;
+ CommandDotnetPublish.Instance.MenuItem.Enabled = false;
+ CommandDotnetNugetPush.Instance.MenuItem.Enabled = false;
+ CommandDotnetClean.Instance.MenuItem.Enabled = false;
+ CommandSettings.Instance.MenuItem.Enabled = false;
+ CommandDeleteBinObj.Instance.MenuItem.Enabled = false;
+
+ await StartDotNetProcessAsync();
+
+ CommandDotnetBuild.Instance.MenuItem.Enabled = true;
+ CommandDotnetPack.Instance.MenuItem.Enabled = true;
+ CommandDotnetPublish.Instance.MenuItem.Enabled = true;
+ CommandDotnetNugetPush.Instance.MenuItem.Enabled = true;
+ CommandDotnetClean.Instance.MenuItem.Enabled = true;
+ CommandSettings.Instance.MenuItem.Enabled = true;
+ CommandDeleteBinObj.Instance.MenuItem.Enabled = true;
+ }
+ */
+
+ internal override async System.Threading.Tasks.Task StartDotNetProcessAsync()
+ {
+ await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(Package.DisposalToken);
+ DTE2 dte2 = (DTE2)await ServiceProvider.GetServiceAsync(typeof(DTE)).ConfigureAwait(false);
+
+ await WindowActivateAsync(EnvDTE.Constants.vsWindowKindOutput);
+
+ var activeConfiguration = await GetActiveSolutionConfigurationAsync();
+ if (activeConfiguration == null)
+ {
+ await PaneWriteLineAsync("Can't not determinate a active solution configuration.");
+ return;
+ }
+
+ string slnfile = await GetSolutionFileNameAsync();
+ string slndir = System.IO.Path.GetDirectoryName(slnfile);
+
+ await PaneClearAsync();
+
+ if (CoreeVisualStudioDotnetToolbarPackage.Instance.Settings.SolutionSettingsGeneral.KillAllDotnetProcessBeforeExectue)
+ {
+ (new System.Diagnostics.Process()).AllDontNetKill("dotnet");
+ }
+
+ List projectInfos = new List();
+
+ if (CoreeVisualStudioDotnetToolbarPackage.Instance.Settings.SolutionSettingsGeneral.BlockNonSdkExecute)
+ {
+ projectInfos = (await GetProjectInfosAsync()).Where(e => e.SolutionDirectoryItemNameLocationExists == true).ToList();
+
+ bool found = false;
+ foreach (var item in projectInfos)
+ {
+ if (item.IsSdkStyle == false)
+ {
+ await PaneWriteLineAsync("-------------------------------------------------------------------------------");
+ await PaneWriteLineAsync($"Non SDK style project file {item.VSProjectLocation} !");
+ await PaneWriteLineAsync("-------------------------------------------------------------------------------");
+ found = true;
+ }
+ }
+ if (found)
+ {
+ await PaneWriteLineAsync("Done");
+ return;
+ }
+ }
+
+ await ExecuteProcessAsync("dotnet.exe", $@"--version", $@"{slndir}");
+ await ExecuteProcessAsync("dotnet.exe", $@"new globaljson --force --sdk-version 8.0.0 --roll-forward=latestFeature", $@"{slndir}");
+
+ await PaneWriteLineAsync("Done");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Coree.VisualStudio.DotnetToolbar/Coree.VisualStudio.DotnetToolbar.csproj b/src/Coree.VisualStudio.DotnetToolbar/Coree.VisualStudio.DotnetToolbar.csproj
index 783cad9..ac12bb7 100644
--- a/src/Coree.VisualStudio.DotnetToolbar/Coree.VisualStudio.DotnetToolbar.csproj
+++ b/src/Coree.VisualStudio.DotnetToolbar/Coree.VisualStudio.DotnetToolbar.csproj
@@ -60,6 +60,10 @@
4
+
+
+
+
Component
diff --git a/src/Coree.VisualStudio.DotnetToolbar/Coree.VisualStudio.DotnetToolbarPackage.cs b/src/Coree.VisualStudio.DotnetToolbar/Coree.VisualStudio.DotnetToolbarPackage.cs
index f138bb9..0a8ab62 100644
--- a/src/Coree.VisualStudio.DotnetToolbar/Coree.VisualStudio.DotnetToolbarPackage.cs
+++ b/src/Coree.VisualStudio.DotnetToolbar/Coree.VisualStudio.DotnetToolbarPackage.cs
@@ -8,6 +8,8 @@
using System;
using System.Collections.Generic;
using System.IO;
+using System.Linq;
+using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
@@ -72,6 +74,7 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
//this.cancellationToken = cancellationToken;
// 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.
+
await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
await CommandDotnetBuild.InitializeAsync(this);
await CommandDotnetPack.InitializeAsync(this);
@@ -81,6 +84,16 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
await CommandDotnetClean.InitializeAsync(this);
await CommandDeleteBinObj.InitializeAsync(this);
await CommandSettings.InitializeAsync(this);
+ await CommandDotnetGlobalJson6.InitializeAsync(this);
+ await CommandDotnetGlobalJson7.InitializeAsync(this);
+ await CommandDotnetGlobalJson8.InitializeAsync(this);
+ await CommandDotnetExperimentalTest.InitializeAsync(this);
+
+
+
+
+ //var sssd = Assembly.GetExecutingAssembly().GetTypes().Where(t => t.IsClass && typeof(CommandBase).IsAssignableFrom(t) && t != typeof(CommandBase)).ToArray();
+
//await CommandDropDown.InitializeAsync(this);
bool isSolutionLoaded = await IsSolutionLoadedAsync();
@@ -124,6 +137,10 @@ private async Task SolutionEvents_OnBeforeCloseSolutionAsync(object sender, Even
CommandDotnetClean.Instance.MenuItem.Enabled = false;
CommandDeleteBinObj.Instance.MenuItem.Enabled = false;
CommandDotnetTest.Instance.MenuItem.Enabled = false;
+ CommandDotnetGlobalJson6.Instance.MenuItem.Enabled = false;
+ CommandDotnetGlobalJson7.Instance.MenuItem.Enabled = false;
+ CommandDotnetGlobalJson8.Instance.MenuItem.Enabled = false;
+ CommandDotnetExperimentalTest.Instance.MenuItem.Enabled = false;
}
private async Task SolutionEvents_OnAfterOpenSolutionAsync(object sender = null, OpenSolutionEventArgs e = null)
@@ -185,7 +202,11 @@ private async Task SolutionEvents_OnAfterOpenSolutionAsync(object sender = null,
EnableMenuItemIfInstanceNotNull(CommandDotnetNugetPush.Instance);
EnableMenuItemIfInstanceNotNull(CommandDotnetClean.Instance);
EnableMenuItemIfInstanceNotNull(CommandDeleteBinObj.Instance);
- EnableMenuItemIfInstanceNotNull(CommandDotnetTest.Instance);
+ EnableMenuItemIfInstanceNotNull(CommandDotnetTest.Instance);
+ EnableMenuItemIfInstanceNotNull(CommandDotnetGlobalJson6.Instance);
+ EnableMenuItemIfInstanceNotNull(CommandDotnetGlobalJson7.Instance);
+ EnableMenuItemIfInstanceNotNull(CommandDotnetGlobalJson8.Instance);
+ EnableMenuItemIfInstanceNotNull(CommandDotnetExperimentalTest.Instance);
}
private static string GetSolutionGuid(string filePath)
diff --git a/src/Coree.VisualStudio.DotnetToolbar/CoreeVisualStudioDotnetToolbarPackage.vsct b/src/Coree.VisualStudio.DotnetToolbar/CoreeVisualStudioDotnetToolbarPackage.vsct
index d862492..71b9d97 100644
--- a/src/Coree.VisualStudio.DotnetToolbar/CoreeVisualStudioDotnetToolbarPackage.vsct
+++ b/src/Coree.VisualStudio.DotnetToolbar/CoreeVisualStudioDotnetToolbarPackage.vsct
@@ -31,22 +31,58 @@
group; your package should define its own command set in order to avoid collisions
with command ids defined by other packages. -->
-
-
@@ -61,15 +97,16 @@
DynamicVisibility
If you do not want an image next to your command, remove the Icon node /> -->
+
+
+
+
+
+
+
+
+
+
+
+
-