From 2ff30955f671ec3745ef4415bec94bc68547b503 Mon Sep 17 00:00:00 2001 From: Deepak <5453503+deepak-rathi@users.noreply.github.com> Date: Wed, 8 Apr 2020 14:55:03 +0530 Subject: [PATCH] Upgraded to .Net Core 3.1 Upgraded packages.config Removed dependency on WindowsAPICodePack --- Setup/Product.Core.wxs | 142 ++++++++++++++++++ Setup/Setup.Core.wixproj | 49 ++++++ VS2017OfflineSetupUtility.sln | 25 +-- VS2017OfflineSetupUtility/App.config | 8 - .../Properties/launchSettings.json | 7 + .../VS2017OfflineSetupUtility.Core.csproj | 56 +++++++ .../VS2017OfflineSetupUtility.csproj | 17 +-- .../ViewModels/CleanUtilPageViewModel.cs | 37 +++-- .../ViewModels/DownloadUtilPageViewModel.cs | 48 ++---- VS2017OfflineSetupUtility/packages.config | 6 - 10 files changed, 304 insertions(+), 91 deletions(-) create mode 100644 Setup/Product.Core.wxs create mode 100644 Setup/Setup.Core.wixproj create mode 100644 VS2017OfflineSetupUtility/Properties/launchSettings.json create mode 100644 VS2017OfflineSetupUtility/VS2017OfflineSetupUtility.Core.csproj delete mode 100644 VS2017OfflineSetupUtility/packages.config diff --git a/Setup/Product.Core.wxs b/Setup/Product.Core.wxs new file mode 100644 index 0000000..3711099 --- /dev/null +++ b/Setup/Product.Core.wxs @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Setup/Setup.Core.wixproj b/Setup/Setup.Core.wixproj new file mode 100644 index 0000000..fe76cb0 --- /dev/null +++ b/Setup/Setup.Core.wixproj @@ -0,0 +1,49 @@ + + + + Debug + x86 + 3.10 + 1de5ec25-4759-43d1-a48f-33fca5ff3134 + 2.0 + VS2017 2019 Offline Setup Utility + Package + + + bin\$(Configuration)\ + obj\$(Configuration)\ + Debug + + + bin\$(Configuration)\ + obj\$(Configuration)\ + False + False + + + + + + + VS2017OfflineSetupUtility + {CFDA2EA7-899E-417F-881A-905A3ED836D6} + True + True + Binaries;Content;Satellites + INSTALLFOLDER + + + + + + + + + \ No newline at end of file diff --git a/VS2017OfflineSetupUtility.sln b/VS2017OfflineSetupUtility.sln index d3739cc..4b10c17 100644 --- a/VS2017OfflineSetupUtility.sln +++ b/VS2017OfflineSetupUtility.sln @@ -1,11 +1,12 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26403.3 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29920.165 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VS2017OfflineSetupUtility", "VS2017OfflineSetupUtility\VS2017OfflineSetupUtility.csproj", "{7163237C-B16D-4B76-84FC-081891585EC4}" EndProject -Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Setup", "Setup\Setup.wixproj", "{1DE5EC25-4759-43D1-A48F-33FCA5FF3134}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VS2017OfflineSetupUtility.Core", "VS2017OfflineSetupUtility\VS2017OfflineSetupUtility.Core.csproj", "{CFDA2EA7-899E-417F-881A-905A3ED836D6}" +EndProject +Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Setup", "Setup\Setup.Core.wixproj", "{1DE5EC25-4759-43D1-A48F-33FCA5FF3134}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,20 +16,20 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7163237C-B16D-4B76-84FC-081891585EC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7163237C-B16D-4B76-84FC-081891585EC4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7163237C-B16D-4B76-84FC-081891585EC4}.Debug|x86.ActiveCfg = Debug|Any CPU - {7163237C-B16D-4B76-84FC-081891585EC4}.Debug|x86.Build.0 = Debug|Any CPU - {7163237C-B16D-4B76-84FC-081891585EC4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7163237C-B16D-4B76-84FC-081891585EC4}.Release|Any CPU.Build.0 = Release|Any CPU - {7163237C-B16D-4B76-84FC-081891585EC4}.Release|x86.ActiveCfg = Release|Any CPU - {7163237C-B16D-4B76-84FC-081891585EC4}.Release|x86.Build.0 = Release|Any CPU {1DE5EC25-4759-43D1-A48F-33FCA5FF3134}.Debug|Any CPU.ActiveCfg = Debug|x86 {1DE5EC25-4759-43D1-A48F-33FCA5FF3134}.Debug|x86.ActiveCfg = Debug|x86 {1DE5EC25-4759-43D1-A48F-33FCA5FF3134}.Debug|x86.Build.0 = Debug|x86 {1DE5EC25-4759-43D1-A48F-33FCA5FF3134}.Release|Any CPU.ActiveCfg = Release|x86 {1DE5EC25-4759-43D1-A48F-33FCA5FF3134}.Release|x86.ActiveCfg = Release|x86 {1DE5EC25-4759-43D1-A48F-33FCA5FF3134}.Release|x86.Build.0 = Release|x86 + {CFDA2EA7-899E-417F-881A-905A3ED836D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CFDA2EA7-899E-417F-881A-905A3ED836D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CFDA2EA7-899E-417F-881A-905A3ED836D6}.Debug|x86.ActiveCfg = Debug|Any CPU + {CFDA2EA7-899E-417F-881A-905A3ED836D6}.Debug|x86.Build.0 = Debug|Any CPU + {CFDA2EA7-899E-417F-881A-905A3ED836D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CFDA2EA7-899E-417F-881A-905A3ED836D6}.Release|Any CPU.Build.0 = Release|Any CPU + {CFDA2EA7-899E-417F-881A-905A3ED836D6}.Release|x86.ActiveCfg = Release|Any CPU + {CFDA2EA7-899E-417F-881A-905A3ED836D6}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/VS2017OfflineSetupUtility/App.config b/VS2017OfflineSetupUtility/App.config index 4749bb5..454856a 100644 --- a/VS2017OfflineSetupUtility/App.config +++ b/VS2017OfflineSetupUtility/App.config @@ -1,13 +1,5 @@  - - -
- - - - - diff --git a/VS2017OfflineSetupUtility/Properties/launchSettings.json b/VS2017OfflineSetupUtility/Properties/launchSettings.json new file mode 100644 index 0000000..86997c7 --- /dev/null +++ b/VS2017OfflineSetupUtility/Properties/launchSettings.json @@ -0,0 +1,7 @@ +{ + "profiles": { + "VS2017OfflineSetupUtility.Core": { + "commandName": "Project" + } + } +} \ No newline at end of file diff --git a/VS2017OfflineSetupUtility/VS2017OfflineSetupUtility.Core.csproj b/VS2017OfflineSetupUtility/VS2017OfflineSetupUtility.Core.csproj new file mode 100644 index 0000000..cd59834 --- /dev/null +++ b/VS2017OfflineSetupUtility/VS2017OfflineSetupUtility.Core.csproj @@ -0,0 +1,56 @@ + + + + WinExe + netcoreapp3.1 + true + true + VS2017OfflineSetupUtility.App + 1.4.1 + VS2017 Offline Setup Utility + + + Deepak Rathi + + https://github.com/deepak-rathi/VS2017OfflineSetupUtility + Git + Added .Net Core 3.1 + VS2017OfflineSetupUtility + Assets\logo.ico + true + LICENSE + Copyright © 2017-2020 Deepak Rathi + This utility allow downloading offline setup or deletion of old version Visual Studio 2017/2019 Offline Setup files and folder. + VS2017OfflineSetupUtility + + + + TRACE + false + + + + + + + + + + True + + + + + + + + + + + True + + PreserveNewest + + + + \ No newline at end of file diff --git a/VS2017OfflineSetupUtility/VS2017OfflineSetupUtility.csproj b/VS2017OfflineSetupUtility/VS2017OfflineSetupUtility.csproj index fbf32aa..85abdd0 100644 --- a/VS2017OfflineSetupUtility/VS2017OfflineSetupUtility.csproj +++ b/VS2017OfflineSetupUtility/VS2017OfflineSetupUtility.csproj @@ -36,17 +36,9 @@ Assets\logo.ico - - ..\packages\WindowsAPICodePack-Core.1.1.2\lib\Microsoft.WindowsAPICodePack.dll - - - ..\packages\WindowsAPICodePack-Shell.1.1.1\lib\Microsoft.WindowsAPICodePack.Shell.dll - - - ..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll - + @@ -126,7 +118,6 @@ ResXFileCodeGenerator Resources.Designer.cs - SettingsSingleFileGenerator Settings.Designer.cs @@ -165,6 +156,10 @@ MSBuild:Compile - + + + 12.0.3 + + \ No newline at end of file diff --git a/VS2017OfflineSetupUtility/ViewModels/CleanUtilPageViewModel.cs b/VS2017OfflineSetupUtility/ViewModels/CleanUtilPageViewModel.cs index 6624247..045cd9b 100644 --- a/VS2017OfflineSetupUtility/ViewModels/CleanUtilPageViewModel.cs +++ b/VS2017OfflineSetupUtility/ViewModels/CleanUtilPageViewModel.cs @@ -13,7 +13,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the You should have received a copy of the GNU General Public License along with this program. If not, see . */ -using Microsoft.WindowsAPICodePack.Dialogs; using System; using System.Collections.ObjectModel; using System.IO; @@ -57,7 +56,7 @@ public ObservableCollection OldVersionModule #endregion #region SelectedFolderPath - private string _selectedFolderPath = Properties.Settings.Default.LastSelectedFolder; + private string _selectedFolderPath; /// /// Contain SelectedFolderPath string /// @@ -83,29 +82,30 @@ public DelegateCommand SelectFolderCommand { return _selectFolderCommand ?? (_selectFolderCommand = new DelegateCommand(() => { + var folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog(); try { - CommonOpenFileDialog dialog = new CommonOpenFileDialog(); - dialog.InitialDirectory = Properties.Settings.Default.LastSelectedFolder; - dialog.IsFolderPicker = true; - dialog.AddToMostRecentlyUsedList = false; - dialog.Title = "Select VS2017 offline setup folder"; + folderBrowserDialog.Description = "Select VS2017 or VS2019 offline setup folder"; + + var dialogResult = folderBrowserDialog.ShowDialog(); + if (dialogResult != System.Windows.Forms.DialogResult.OK && string.IsNullOrWhiteSpace(folderBrowserDialog.SelectedPath)) + return; + + SelectedFolderPath = folderBrowserDialog.SelectedPath; + DoClassification(); + + if (!OldVersionModule.Any()) + System.Windows.MessageBox.Show("Old version folder does not exist."); - if (dialog.ShowDialog() == CommonFileDialogResult.Ok) - { - SelectedFolderPath = dialog.FileName; - Properties.Settings.Default.LastSelectedFolder = SelectedFolderPath; - Properties.Settings.Default.Save(); - DoClassification(); - - if (!OldVersionModule.Any()) - MessageBox.Show("Old version folder does not exist."); - } } catch (Exception exception) { System.Diagnostics.Debug.WriteLine(exception.Message); } + finally + { + folderBrowserDialog.Dispose(); + } })); } } @@ -119,9 +119,8 @@ public void DoClassification() OldVersionModule.Clear(); DirectoryInfo dirInfo = new DirectoryInfo(SelectedFolderPath); - if(dirInfo!=null && !dirInfo.Exists) + if (dirInfo != null && !dirInfo.Exists) { - Properties.Settings.Default.LastSelectedFolder = ""; SelectedFolderPath = ""; return; } diff --git a/VS2017OfflineSetupUtility/ViewModels/DownloadUtilPageViewModel.cs b/VS2017OfflineSetupUtility/ViewModels/DownloadUtilPageViewModel.cs index ef55d27..0325934 100644 --- a/VS2017OfflineSetupUtility/ViewModels/DownloadUtilPageViewModel.cs +++ b/VS2017OfflineSetupUtility/ViewModels/DownloadUtilPageViewModel.cs @@ -13,7 +13,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the You should have received a copy of the GNU General Public License along with this program. If not, see . */ -using Microsoft.WindowsAPICodePack.Dialogs; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -38,12 +37,11 @@ public DownloadUtilPageViewModel() AllVisualStudioEditions = VsEditionUtil.GetAllVisualStudioEditions(); SelectedVsEdition = AllVisualStudioEditions.FirstOrDefault(); DownloadWorkloadFromWeb(SelectedVsEdition); - CheckIfPreviouslySelectedFolderStillExist(); } #endregion #region SelectedFolderPath - private string _selectedFolderPath = Properties.Settings.Default.LastSelectedFolder; + private string _selectedFolderPath; /// /// Contain SelectedFolderPath string /// @@ -69,51 +67,31 @@ public DelegateCommand SelectFolderCommand { return _selectFolderCommand ?? (_selectFolderCommand = new DelegateCommand(() => { + var folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog(); try { - CommonOpenFileDialog dialog = new CommonOpenFileDialog(); - dialog.InitialDirectory = Properties.Settings.Default.LastSelectedFolder; - dialog.IsFolderPicker = true; - dialog.AddToMostRecentlyUsedList = false; - dialog.Title = "Select VS2017 offline setup folder"; + folderBrowserDialog.Description = "Select VS2017 or VS2019 offline setup folder"; - if (dialog.ShowDialog() == CommonFileDialogResult.Ok) - { - SelectedFolderPath = dialog.FileName; - Properties.Settings.Default.LastSelectedFolder = SelectedFolderPath; - Properties.Settings.Default.Save(); - GenerateCli(SelectedVsEdition); - } + var dialogResult = folderBrowserDialog.ShowDialog(); + if (dialogResult != System.Windows.Forms.DialogResult.OK && string.IsNullOrWhiteSpace(folderBrowserDialog.SelectedPath)) + return; + + SelectedFolderPath = folderBrowserDialog.SelectedPath; + GenerateCli(SelectedVsEdition); } catch (Exception exception) { System.Diagnostics.Debug.WriteLine(exception.Message); } + finally + { + folderBrowserDialog.Dispose(); + } })); } } #endregion - #region CheckIfPreviouslySelectedFolderStillExist - /// - /// Check if previously selected folder still exist, if not reset last selected folder value - /// - private void CheckIfPreviouslySelectedFolderStillExist() - { - var lastSelectedFolder = Properties.Settings.Default.LastSelectedFolder; - if (string.IsNullOrWhiteSpace(lastSelectedFolder)) - return; - - DirectoryInfo dirInfo = new DirectoryInfo(SelectedFolderPath); - if (dirInfo != null && !dirInfo.Exists) - { - Properties.Settings.Default.LastSelectedFolder = ""; - SelectedFolderPath = ""; - return; - } - } - #endregion - #region VsEdition private VsEdition _vsEdition; diff --git a/VS2017OfflineSetupUtility/packages.config b/VS2017OfflineSetupUtility/packages.config deleted file mode 100644 index 3c5cb8d..0000000 --- a/VS2017OfflineSetupUtility/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file