Skip to content

Commit da88515

Browse files
Merge pull request #63 from codingadventures/LINQBridgeVs2.0
LINQBridgeVs version 2.0
2 parents df842d8 + 4a3c288 commit da88515

File tree

77 files changed

+535
-2775
lines changed

Some content is hidden

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

77 files changed

+535
-2775
lines changed
File renamed without changes.

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

+175-216
Large diffs are not rendered by default.

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

+10-6
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@
2828
using System.ComponentModel.Design;
2929
using System.IO;
3030
using System.Linq;
31-
using System.Windows;
32-
using BridgeVs.Shared.Common;
3331
using BridgeVs.VsPackage.Helper;
3432
using BridgeVs.VsPackage.Helper.Command;
3533
using BridgeVs.VsPackage.Helper.Configuration;
3634
using EnvDTE;
3735
using Project = EnvDTE.Project;
3836

39-
namespace BridgeVs.VsPackage
37+
namespace BridgeVs.VisualStudio.AsyncExtension
4038
{
4139
public class BridgeVsExtension
4240
{
@@ -57,6 +55,7 @@ private IEnumerable<Project> AllProjects
5755
{
5856
get
5957
{
58+
Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
6059
Projects projects = _application.Solution.Projects;
6160
if (projects == null)
6261
return Enumerable.Empty<Project>();
@@ -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

@@ -97,14 +97,18 @@ public void UpdateCommand(MenuCommand cmd, CommandAction action)
9797

9898
private CommandStates GetStatus(CommandAction action)
9999
{
100+
Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
101+
100102
CommandStates result = CommandStates.Visible;
101103

102104
bool isBridgeVsConfigured = PackageConfigurator.IsBridgeVsConfigured(_application.Version);
103105

104106
if (!isBridgeVsConfigured)
105107
return result; //just show it as visible
106108

107-
bool isSolutionEnabled = CommonRegistryConfigurations.IsSolutionEnabled(SolutionName, _application.Version);
109+
string solutionDir = Path.GetDirectoryName(_application.Solution.FileName);
110+
string directoryTarget = Path.Combine(solutionDir, "Directory.Build.targets");
111+
bool isSolutionEnabled = File.Exists(directoryTarget);
108112

109113
if (isSolutionEnabled && action == CommandAction.Disable || !isSolutionEnabled && action == CommandAction.Enable)
110114
result |= CommandStates.Enabled;

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

+15-1
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
@@ -70,6 +76,7 @@ public static void ActivateBridgeVsOnSolution(CommandAction action, List<Project
7076
if (project.Object is VSProject vsProject && vsProject.References != null)
7177
{
7278
references = from Reference reference in vsProject.References
79+
where reference.Path != null
7380
where reference.SourceProject == null //it means it's an assembly reference
7481
where !reference.Path.Contains(".NETFramework") && !reference.Path.Contains("Microsoft") //no .net framework assembly
7582
select reference.Path;
@@ -83,9 +90,14 @@ public static void ActivateBridgeVsOnSolution(CommandAction action, List<Project
8390
{
8491
case CommandAction.Enable:
8592
CommonRegistryConfigurations.BridgeSolution(solutionName, vsVersion, executeParams);
93+
//copy directory build target to the solution folder
94+
string target = PackageConfigurator.GetInstallationFolder(vsVersion);
95+
File.Copy(Path.Combine(target, "Targets", DirectoryBuildTargets), Path.Combine(solutionFolder, DirectoryBuildTargets), true);
8696
break;
8797
case CommandAction.Disable:
8898
CommonRegistryConfigurations.UnBridgeSolution(solutionName, vsVersion);
99+
//delete directory build target
100+
File.Delete(Path.Combine(solutionFolder, DirectoryBuildTargets));
89101
break;
90102
}
91103

@@ -99,6 +111,8 @@ public static void ActivateBridgeVsOnSolution(CommandAction action, List<Project
99111
public static bool IsEveryProjectSupported(List<Project> projects, string applicationVersion,
100112
string applicationEdition)
101113
{
114+
Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
115+
102116
foreach (Project project in projects)
103117
{
104118
string targetFramework = project.Properties.Item("TargetFrameworkMoniker").Value.ToString();

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

+2
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 Src/BridgeVs.AsyncVsPackage/Configuration/PackageConfigurator.cs

+6-17
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/Resources1.Designer.cs Src/BridgeVs.AsyncVsPackage/Configuration/Resources1.Designer.cs

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

Src/BridgeVs.VsPackage/Guids.cs Src/BridgeVs.AsyncVsPackage/Guids.cs

+1-1
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
{
File renamed without changes.
File renamed without changes.

Src/BridgeVs.VsPackage/PkgCmdID.cs Src/BridgeVs.AsyncVsPackage/PkgCmdID.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// OTHER DEALINGS IN THE SOFTWARE.
2424
#endregion
2525

26-
namespace BridgeVs.VsPackage
26+
namespace BridgeVs.VisualStudio.AsyncExtension
2727
{
2828
internal static class PkgCmdIdList
2929
{
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#region License
2-
// Copyright (c) 2013 Coding Adventures
2+
// Copyright (c) 2013 - 2018 Coding Adventures
33
//
44
// Permission is hereby granted, free of charge, to any person
55
// obtaining a copy of this software and associated documentation
@@ -23,43 +23,14 @@
2323
// OTHER DEALINGS IN THE SOFTWARE.
2424
#endregion
2525

26-
using System;
26+
2727
using System.Reflection;
2828
using System.Runtime.CompilerServices;
2929
using System.Runtime.InteropServices;
3030

31-
// General Information about an assembly is controlled through the following
32-
// set of attributes. Change these attribute values to modify the information
33-
// associated with an assembly.
34-
[assembly: AssemblyTitle("BridgeVs.VsPackage.Helper")]
35-
[assembly: AssemblyDescription("")]
36-
[assembly: AssemblyConfiguration("")]
37-
[assembly: AssemblyCompany("Coding Advengures")]
38-
[assembly: AssemblyProduct("BridgeVs.VsPackage.Helper")]
39-
[assembly: AssemblyCopyright("Copyright © Coding Adventures 2013 - 2018")]
40-
[assembly: AssemblyTrademark("")]
41-
[assembly: AssemblyCulture("")]
42-
43-
// Setting ComVisible to false makes the types in this assembly not visible
44-
// to COM components. If you need to access a type in this assembly from
45-
// COM, set the ComVisible attribute to true on that type.
46-
[assembly: ComVisible(false)]
47-
[assembly: CLSCompliant(false)]
48-
49-
// The following GUID is for the ID of the typelib if this project is exposed to COM
50-
[assembly: Guid("916dc547-062f-4fb4-90f7-a4bf1cf4d815")]
51-
52-
// Version information for an assembly consists of the following four values:
53-
//
54-
// Major Version
55-
// Minor Version
56-
// Build Number
57-
// Revision
58-
//
59-
// You can specify all the values or you can default the Build and Revision Numbers
60-
// by using the '*' as shown below:
61-
// [assembly: AssemblyVersion("1.0.*")]
62-
[assembly: AssemblyVersion("1.4.7.*")]
31+
[assembly: AssemblyTitle("BridgeVs.AsyncVsPackage")]
32+
[assembly: AssemblyProduct("BridgeVs.VisualStudio.AsyncExtension")]
33+
[assembly: Guid("2016fd5d-79e9-4823-b927-cb796f7b411a")]
6334
#if TEST
6435
[assembly: InternalsVisibleTo("BridgeVs.UnitTest, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f575ceee4c0b7992660f21a6c2a09c93eac56d9dad2f20caa2d48bf5d904c9b2af5800ba01cae7b37299bff9486a8b97047959c3fbe16de730cf3397f4bafaefc745dba1ce34cedf27698f2dc96159eaa27eef4093f6c35236f30239a4841b864ea734ed3582478cc4214d76497ceb974ac920f35043de0913a149d1107bd3a1")]
65-
#endif
36+
#endif
Loading
Loading

Src/BridgeVs.VsPackage.Helper/Settings/PackageSettings.cs Src/BridgeVs.AsyncVsPackage/Settings/PackageSettings.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@
3636
using BridgeVs.Shared.Options;
3737

3838
namespace BridgeVs.VsPackage.Helper.Settings
39-
{
40-
/// <inheritdoc />
41-
[ClassInterface(ClassInterfaceType.None)]
42-
[CLSCompliant(false), ComVisible(true)]
39+
{
4340
public sealed class PackageSettings : DialogPage
4441
{
4542
private const string ErrorMessage = "Please insert a valid path to LINQPad";

Src/BridgeVs.VsPackage/LINQBridgePackage.vsct Src/BridgeVs.AsyncVsPackage/VSPackage.vsct

+2-30
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<CommandTable xmlns="http://schemas.microsoft.com/VisualStudio/2005-10-18/CommandTable" xmlns:xs="http://www.w3.org/2001/XMLSchema">
33

44
<!-- This is the file that defines the actual layout and type of the commands.
@@ -54,8 +54,8 @@
5454
</Strings>
5555
</Menu>
5656
</Menus>
57+
5758
<Groups>
58-
5959
<Group guid="guidTopLevelMenuCmdSet" id="MyMenuGroup" priority="0x0600">
6060
<Parent guid="guidTopLevelMenuCmdSet" id="LINQBridge" />
6161
</Group>
@@ -112,38 +112,10 @@
112112
</Strings>
113113
</Button>
114114

115-
116-
<!--<Button guid="guidLINQBridgeVsPackageCmdSet" id="cmdidToolWindow1Command" priority="0x0100" type="Button">
117-
<Parent guid="guidSHLMainMenu" id="IDG_VS_WNDO_OTRWNDWS1" />
118-
<Icon guid="guidImages1" id="bmpPic1" />
119-
<Strings>
120-
<ButtonText>ToolWindow1</ButtonText>
121-
</Strings>
122-
</Button>-->
123115
</Buttons>
124116

125-
<!--The bitmaps section is used to define the bitmaps that are used for the commands.-->
126-
<Bitmaps>
127-
<!-- The bitmap id is defined in a way that is a little bit different from the others:
128-
the declaration starts with a guid for the bitmap strip, then there is the resource id of the
129-
bitmap strip containing the bitmaps and then there are the numeric ids of the elements used
130-
inside a button definition. An important aspect of this declaration is that the element id
131-
must be the actual index (1-based) of the bitmap inside the bitmap strip.
132-
<Bitmap guid="guidImages" href="Resources\Images.png" usedList="bmpPic1, bmpPic2, bmpPicSearch, bmpPicX, bmpPicArrows" />-->
133-
</Bitmaps>
134-
135117
</Commands>
136118

137-
<!--<CommandPlacements>
138-
--><!--Here we place two commands inside the empty menu group we created in the Groups section.--><!--
139-
<CommandPlacement guid="guidTopLevelMenuCmdSet" id="CmdIdStarted" priority="0x100">
140-
<Parent guid="guidTopLevelMenuCmdSet" id="HelpGroup"/>
141-
</CommandPlacement>
142-
<CommandPlacement guid="guidTopLevelMenuCmdSet" id="CmdIdFeedback" priority="0x200">
143-
<Parent guid="guidTopLevelMenuCmdSet" id="HelpGroup"/>
144-
</CommandPlacement>
145-
</CommandPlacements>-->
146-
147119
<VisibilityConstraints>
148120
<VisibilityItem guid="guidTopLevelMenuCmdSet" id="CmdIdEnableBridge" context="UICONTEXT_SolutionExistsAndNotBuildingAndNotDebugging" />
149121
<VisibilityItem guid="guidTopLevelMenuCmdSet" id="CmdIdDisableBridge" context="UICONTEXT_SolutionExistsAndNotBuildingAndNotDebugging" />

0 commit comments

Comments
 (0)