Skip to content

Commit 981b127

Browse files
Adds support for VS 2019
Major refactor: - adds support to VS 2019 - drops the configuration process that requires admin privileges - only supports vs 2017 and 2019 - migrates the package to be async
1 parent df842d8 commit 981b127

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+465
-2629
lines changed

Src/BridgeVs.VsPackage/BridgeVs.VsPackage.csproj renamed to Src/BridgeVs.AsyncVsPackage/BridgeVs.VisualStudio.AsyncExtension.csproj

Lines changed: 166 additions & 216 deletions
Large diffs are not rendered by default.

Src/BridgeVs.VsPackage/LINQBridgeExtension.cs renamed to Src/BridgeVs.AsyncVsPackage/BridgeVsExtension.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,14 @@
2828
using System.ComponentModel.Design;
2929
using System.IO;
3030
using System.Linq;
31-
using System.Windows;
3231
using BridgeVs.Shared.Common;
3332
using BridgeVs.VsPackage.Helper;
3433
using BridgeVs.VsPackage.Helper.Command;
3534
using BridgeVs.VsPackage.Helper.Configuration;
3635
using EnvDTE;
3736
using Project = EnvDTE.Project;
3837

39-
namespace BridgeVs.VsPackage
38+
namespace BridgeVs.VisualStudio.AsyncExtension
4039
{
4140
public class BridgeVsExtension
4241
{
@@ -71,6 +70,7 @@ where IsSupported(project.UniqueName)
7170

7271
public void Execute(CommandAction action)
7372
{
73+
Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
7474
List<Project> projects = AllProjects.ToList();
7575

7676
if (projects.Count == 0)
@@ -79,12 +79,12 @@ public void Execute(CommandAction action)
7979
if (BridgeCommand.IsEveryProjectSupported(projects, _application.Version, _application.Edition))
8080
{
8181
BridgeCommand.ActivateBridgeVsOnSolution(action, projects, SolutionName, _application.Version,
82-
_application.Edition);
82+
_application.Edition, Path.GetDirectoryName(_application.Solution.FileName));
8383
}
8484
else
8585
{
8686
string message = $@"Solution {SolutionName} contains one or more un-supported projects. ASP.NET Core, .NET Core, .NET standard and UAP are not supported by LINQBridgeVs.";
87-
MessageBox.Show(message);
87+
System.Windows.MessageBox.Show(message);
8888
}
8989
}
9090

Src/BridgeVs.VsPackage.Helper/Command/BridgeCommand.cs renamed to Src/BridgeVs.AsyncVsPackage/Command/BridgeCommand.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#endregion
2525

2626
using BridgeVs.Shared.Common;
27+
using BridgeVs.Shared.FileSystem;
28+
using BridgeVs.VsPackage.Helper.Configuration;
2729
using EnvDTE;
2830
using System;
2931
using System.Collections.Generic;
@@ -36,6 +38,7 @@ namespace BridgeVs.VsPackage.Helper.Command
3638
{
3739
public static class BridgeCommand
3840
{
41+
private const string DirectoryBuildTargets = "Directory.Build.targets";
3942
private static readonly List<string> UnsupportedFrameworks = new List<string>(20)
4043
{
4144
"netstandard",
@@ -51,8 +54,11 @@ public static class BridgeCommand
5154

5255
public static void ActivateBridgeVsOnSolution(CommandAction action, List<Project> projects, string solutionName,
5356
string vsVersion,
54-
string vsEdition)
57+
string vsEdition,
58+
string solutionFolder)
5559
{
60+
Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
61+
5662
List<BridgeProjectInfo> executeParams = new List<BridgeProjectInfo>();
5763

5864
//enable each individual project by mapping the assembly name and location to a registry entry
@@ -83,9 +89,14 @@ public static void ActivateBridgeVsOnSolution(CommandAction action, List<Project
8389
{
8490
case CommandAction.Enable:
8591
CommonRegistryConfigurations.BridgeSolution(solutionName, vsVersion, executeParams);
92+
//copy directory build target to the solution folder
93+
string target = PackageConfigurator.GetInstallationFolder(vsVersion);
94+
File.Copy(Path.Combine(target, "Targets", DirectoryBuildTargets), Path.Combine(solutionFolder, DirectoryBuildTargets), true);
8695
break;
8796
case CommandAction.Disable:
8897
CommonRegistryConfigurations.UnBridgeSolution(solutionName, vsVersion);
98+
//delete directory build target
99+
File.Delete(Path.Combine(solutionFolder, DirectoryBuildTargets));
89100
break;
90101
}
91102

@@ -99,6 +110,8 @@ public static void ActivateBridgeVsOnSolution(CommandAction action, List<Project
99110
public static bool IsEveryProjectSupported(List<Project> projects, string applicationVersion,
100111
string applicationEdition)
101112
{
113+
Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
114+
102115
foreach (Project project in projects)
103116
{
104117
string targetFramework = project.Properties.Item("TargetFrameworkMoniker").Value.ToString();

Src/BridgeVs.VsPackage.Helper/Configuration/MsBuildVersionHelper.cs renamed to Src/BridgeVs.AsyncVsPackage/Configuration/MsBuildVersionHelper.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public static string GetMsBuildVersion(string vsVersion)
4141
return "v14.0";
4242
case "15.0":
4343
return "v15.0";
44+
case "16.0":
45+
return "v16.0";
4446
default :
4547
throw new ArgumentException("Visual Studio Version not Supported", nameof(vsVersion));
4648
}

Src/BridgeVs.VsPackage.Helper/Configuration/PackageConfigurator.cs renamed to Src/BridgeVs.AsyncVsPackage/Configuration/PackageConfigurator.cs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
using System.Security.Principal;
3333
using System.Windows.Forms;
3434
using BridgeVs.Shared.Common;
35+
using BridgeVs.VisualStudio.AsyncExtension.Configuration;
3536
using Microsoft.Win32;
3637
using OpenFileDialog = System.Windows.Forms.OpenFileDialog;
3738

@@ -121,20 +122,6 @@ private static bool IsLINQPadInstalled(string vsVersion)
121122
return false;
122123
}
123124

124-
private static void DeployMsBuildTargets(string vsVersion, string vsEdition)
125-
{
126-
string msBuildDir = CreateMsBuildTargetDirectory(vsVersion, vsEdition);
127-
//Copy the CustomAfter and CustomBefore to the default MSBuild v4.0 location
128-
File.Copy(CommonFolderPaths.CustomAfterTargetFileNamePath, Path.Combine(msBuildDir, CommonFolderPaths.CustomAfterTargetFileName), true);
129-
130-
string customBeforeTarget = Path.Combine(msBuildDir, CommonFolderPaths.CustomBeforeTargetFileName);
131-
if (File.Exists(customBeforeTarget)) //old before target, now obsolete
132-
{
133-
File.Delete(customBeforeTarget);
134-
}
135-
136-
}
137-
138125
private static void SetInstallationFolder(string vsVersion)
139126
{
140127
//Set in the registry the installer location if it is has changed
@@ -151,7 +138,7 @@ private static void SetInstallationFolder(string vsVersion)
151138
}
152139
}
153140

154-
private static string GetInstallationFolder(string vsVersion)
141+
public static string GetInstallationFolder(string vsVersion)
155142
{
156143
//Set in the registry the installer location if it is has changed
157144
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(CommonRegistryConfigurations.GetRegistryKey(Resources.ProductRegistryKey, vsVersion)))
@@ -235,8 +222,6 @@ public static bool Install(string vsVersion, string vsEdition)
235222
//Always check if installation folder has changed
236223
SetInstallationFolder(vsVersion);
237224

238-
DeployMsBuildTargets(vsVersion, vsEdition);
239-
240225
GenerateGuidForCurrentInstallation(vsVersion);
241226

242227
DeleteExistingVisualizers(vsVersion);
@@ -314,6 +299,10 @@ private static string DebuggerVisualizerTargetFolder(string vsVersion)
314299
case "15.0":
315300
debuggerVisualizerTargetFolder = CommonFolderPaths.Vs2017DebuggerVisualizerDestinationFolder;
316301
break;
302+
case "16.0":
303+
debuggerVisualizerTargetFolder = CommonFolderPaths.Vs2019DebuggerVisualizerDestinationFolder;
304+
break;
305+
317306
}
318307

319308
return debuggerVisualizerTargetFolder;

Src/BridgeVs.VsPackage.Helper/Configuration/Resources.resx renamed to Src/BridgeVs.AsyncVsPackage/Configuration/Resources.resx

File renamed without changes.

Src/BridgeVs.VsPackage.Helper/Configuration/Resources1.Designer.cs renamed to Src/BridgeVs.AsyncVsPackage/Configuration/Resources1.Designer.cs

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
using System;
2727

28-
namespace BridgeVs.VsPackage
28+
namespace BridgeVs.VisualStudio.AsyncExtension
2929
{
3030
public static class GuidList
3131
{

0 commit comments

Comments
 (0)