Skip to content

Commit 2f61a3d

Browse files
code cleanup
1 parent 981b127 commit 2f61a3d

25 files changed

+89
-103
lines changed

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<AppDesignerFolder>Properties</AppDesignerFolder>
3636
<RootNamespace>BridgeVs.VisualStudio.AsyncExtension</RootNamespace>
3737
<AssemblyName>BridgeVs.VisualStudio.AsyncExtension</AssemblyName>
38-
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
38+
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
3939
<GeneratePkgDefFile>true</GeneratePkgDefFile>
4040
<IncludeAssemblyInVSIXContainer>true</IncludeAssemblyInVSIXContainer>
4141
<IncludeDebugSymbolsInVSIXContainer>true</IncludeDebugSymbolsInVSIXContainer>
@@ -283,6 +283,12 @@
283283
</EmbeddedResource>
284284
</ItemGroup>
285285
<ItemGroup>
286+
<ProjectReference Include="..\..\Lib\SharpRaven\src\app\SharpRaven\SharpRaven.csproj">
287+
<Project>{31fe81f8-6e49-432c-b0b2-658e76f96983}</Project>
288+
<Name>SharpRaven</Name>
289+
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
290+
<AdditionalProperties>TargetFramework=net40</AdditionalProperties>
291+
</ProjectReference>
286292
<ProjectReference Include="..\BridgeVs.Build\BridgeVs.Build.csproj">
287293
<Project>{276f3935-e0ca-450f-a55f-aed56dc2024e}</Project>
288294
<Name>BridgeVs.Build</Name>

Src/BridgeVs.AsyncVsPackage/BridgeVsExtension.cs

+6-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
using System.ComponentModel.Design;
2929
using System.IO;
3030
using System.Linq;
31-
using BridgeVs.Shared.Common;
3231
using BridgeVs.VsPackage.Helper;
3332
using BridgeVs.VsPackage.Helper.Command;
3433
using BridgeVs.VsPackage.Helper.Configuration;
@@ -56,6 +55,7 @@ private IEnumerable<Project> AllProjects
5655
{
5756
get
5857
{
58+
Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
5959
Projects projects = _application.Solution.Projects;
6060
if (projects == null)
6161
return Enumerable.Empty<Project>();
@@ -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.AsyncVsPackage/Command/BridgeCommand.cs

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public static void ActivateBridgeVsOnSolution(CommandAction action, List<Project
7676
if (project.Object is VSProject vsProject && vsProject.References != null)
7777
{
7878
references = from Reference reference in vsProject.References
79+
where reference.Path != null
7980
where reference.SourceProject == null //it means it's an assembly reference
8081
where !reference.Path.Contains(".NETFramework") && !reference.Path.Contains("Microsoft") //no .net framework assembly
8182
select reference.Path;

Src/BridgeVs.AsyncVsPackage/app.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
</dependentAssembly>
1313
</assemblyBinding>
1414
</runtime>
15-
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration>
15+
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/></startup></configuration>

Src/BridgeVs.Build/BridgeVs.Build.csproj

+7-2
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,23 @@
1010
<AppDesignerFolder>Properties</AppDesignerFolder>
1111
<RootNamespace>BridgeVs.Build</RootNamespace>
1212
<AssemblyName>BridgeVs.Build</AssemblyName>
13-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
13+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1414
<FileAlignment>512</FileAlignment>
1515
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
1616
<RestorePackages>true</RestorePackages>
17+
<TargetFrameworkProfile />
1718
</PropertyGroup>
1819
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
1920
<OutputPath>bin\Debug\</OutputPath>
2021
<DefineConstants>TRACE;DEBUG</DefineConstants>
22+
<Prefer32Bit>false</Prefer32Bit>
2123
</PropertyGroup>
2224
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Test|AnyCPU'">
2325
<OutputPath>bin\Test\</OutputPath>
2426
<DefineConstants>TRACE;DEBUG;TEST</DefineConstants>
2527
<DebugType>full</DebugType>
2628
<DebugSymbols>true</DebugSymbols>
29+
<Prefer32Bit>false</Prefer32Bit>
2730
</PropertyGroup>
2831
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Deploy|AnyCPU'">
2932
<OutputPath>bin\Deploy\</OutputPath>
@@ -32,12 +35,13 @@
3235
<Optimize>true</Optimize>
3336
<DebugType>pdbonly</DebugType>
3437
<DebugSymbols>true</DebugSymbols>
38+
<Prefer32Bit>false</Prefer32Bit>
3539
</PropertyGroup>
3640
<PropertyGroup>
3741
<SignAssembly>true</SignAssembly>
3842
</PropertyGroup>
3943
<PropertyGroup>
40-
<AssemblyOriginatorKeyFile>..\BridgeVs.VsPackage\Key.snk</AssemblyOriginatorKeyFile>
44+
<AssemblyOriginatorKeyFile>..\BridgeVs.AsyncVsPackage\Key.snk</AssemblyOriginatorKeyFile>
4145
</PropertyGroup>
4246
<ItemGroup>
4347
<Compile Include="SInjection.cs" />
@@ -54,6 +58,7 @@
5458
<ItemGroup>
5559
<ProjectReference Include="..\..\Lib\SharpRaven\src\app\SharpRaven\SharpRaven.csproj">
5660
<Project>{31fe81f8-6e49-432c-b0b2-658e76f96983}</Project>
61+
<AdditionalProperties>TargetFramework=net40</AdditionalProperties>
5762
<Name>SharpRaven</Name>
5863
</ProjectReference>
5964
<ProjectReference Include="..\BridgeVs.DynamicVisualizers\BridgeVs.DynamicVisualizers.csproj">

Src/BridgeVs.Build/Tasks/CleanBuildTask.cs

+1-6
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,7 @@ public class CleanBuildTask : ITask
5151
public bool Execute()
5252
{
5353
Log.VisualStudioVersion = VisualStudioVer;
54-
55-
if (!CommonRegistryConfigurations.IsSolutionEnabled(SolutionName, VisualStudioVer))
56-
{
57-
return true;
58-
}
59-
54+
6055
try
6156
{
6257
string visualizerAssemblyName = VisualizerAssemblyNameFormat.GetTargetVisualizerAssemblyName(VisualStudioVer, Assembly);

Src/BridgeVs.Build/Tasks/MapperBuildTask.cs

+8-13
Original file line numberDiff line numberDiff line change
@@ -81,27 +81,16 @@ public bool Execute()
8181
{
8282
Log.VisualStudioVersion = VisualStudioVer;
8383

84-
if (!CommonRegistryConfigurations.IsSolutionEnabled(SolutionName, VisualStudioVer))
85-
{
86-
return true;
87-
}
88-
8984
Log.Write($"Visualizer Destination Folder Path {VisualizerDestinationFolder}");
9085

91-
9286
Create3RdPartyVisualizers();
9387

94-
//if dot net visualizer exists already don't create it again
95-
if (!FS.FileSystem.File.Exists(Path.Combine(VisualizerDestinationFolder, DotNetVisualizerAssemblyName)))
96-
{
97-
//it creates a mapping for all of the .net types that are worth exporting
98-
CreateDotNetFrameworkVisualizer();
99-
}
88+
//it creates a mapping for all of the .net types that are worth exporting
89+
CreateDotNetFrameworkVisualizer();
10090

10191
CreateDebuggerVisualizer();
10292

10393
return true;
104-
10594
}
10695

10796
private void Create3RdPartyVisualizers()
@@ -183,6 +172,12 @@ private void CreateDebuggerVisualizer()
183172

184173
private void CreateDotNetFrameworkVisualizer()
185174
{
175+
176+
//if dot net visualizer exists already don't create it again
177+
if (FS.FileSystem.File.Exists(Path.Combine(VisualizerDestinationFolder, DotNetVisualizerAssemblyName)))
178+
{
179+
return;
180+
}
186181
try
187182
{
188183
//this is where the current assembly being built is saved

Src/BridgeVs.Build/Tasks/SInjectionBuildTask.cs

+1-6
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,7 @@ public class SInjectionBuildTask : ITask
4848
public bool Execute()
4949
{
5050
Log.VisualStudioVersion = VisualStudioVer;
51-
52-
if (!CommonRegistryConfigurations.IsSolutionEnabled(SolutionName, VisualStudioVer))
53-
{
54-
return true;
55-
}
56-
51+
5752
try
5853
{
5954
string snkCertificate = File.Exists(Snk) ? Snk : null;

Src/BridgeVs.Build/app.config

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<runtime>
44

55
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
66

77
<dependentAssembly>
88

9-
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
9+
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
1010

11-
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
11+
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0"/>
1212

1313
</dependentAssembly>
1414

1515
</assemblyBinding>
1616
</runtime>
17-
</configuration>
17+
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>

Src/BridgeVs.Build/packages.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="Mono.Cecil" version="0.10.0" targetFramework="net40" />
4-
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net40" />
4+
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net40" requireReinstallation="true" />
55
<package id="System.IO.Abstractions" version="2.1.0.256" targetFramework="net40" />
66
</packages>

Src/BridgeVs.DynamicVisualizers/BridgeVs.DynamicVisualizers.csproj

+12-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<FileAlignment>512</FileAlignment>
1414
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
1515
<RestorePackages>true</RestorePackages>
16+
<TargetFrameworkProfile />
1617
</PropertyGroup>
1718
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1819
<DebugSymbols>true</DebugSymbols>
@@ -22,12 +23,13 @@
2223
<DefineConstants>DEBUG;TRACE</DefineConstants>
2324
<ErrorReport>prompt</ErrorReport>
2425
<WarningLevel>4</WarningLevel>
26+
<Prefer32Bit>false</Prefer32Bit>
2527
</PropertyGroup>
2628
<PropertyGroup>
2729
<SignAssembly>true</SignAssembly>
2830
</PropertyGroup>
2931
<PropertyGroup>
30-
<AssemblyOriginatorKeyFile>..\BridgeVs.VsPackage\Key.snk</AssemblyOriginatorKeyFile>
32+
<AssemblyOriginatorKeyFile>..\BridgeVs.AsyncVsPackage\Key.snk</AssemblyOriginatorKeyFile>
3133
</PropertyGroup>
3234
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Test|AnyCPU' ">
3335
<DebugType>full</DebugType>
@@ -37,6 +39,7 @@
3739
<DefineConstants>TRACE;DEBUG;TEST</DefineConstants>
3840
<ErrorReport>prompt</ErrorReport>
3941
<WarningLevel>4</WarningLevel>
42+
<Prefer32Bit>false</Prefer32Bit>
4043
</PropertyGroup>
4144
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Deploy|AnyCPU' ">
4245
<DebugType>pdbonly</DebugType>
@@ -46,6 +49,7 @@
4649
<ErrorReport>prompt</ErrorReport>
4750
<WarningLevel>4</WarningLevel>
4851
<DebugSymbols>true</DebugSymbols>
52+
<Prefer32Bit>false</Prefer32Bit>
4953
</PropertyGroup>
5054
<ItemGroup>
5155
<Reference Include="Microsoft.CSharp" />
@@ -65,6 +69,12 @@
6569
<Reference Include="System.IO.Abstractions, Version=2.1.0.256, Culture=neutral, PublicKeyToken=96bf224d23c43e59, processorArchitecture=MSIL">
6670
<HintPath>..\packages\System.IO.Abstractions.2.1.0.256\lib\net40\System.IO.Abstractions.dll</HintPath>
6771
</Reference>
72+
<Reference Include="System.Threading.Tasks.Extensions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
73+
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.3.0\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll</HintPath>
74+
</Reference>
75+
<Reference Include="System.ValueTuple, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
76+
<HintPath>..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
77+
</Reference>
6878
<Reference Include="System.Windows.Forms" />
6979
<Reference Include="System.Xml" />
7080
</ItemGroup>
@@ -111,6 +121,7 @@
111121
<ProjectReference Include="..\..\Lib\SharpRaven\src\app\SharpRaven\SharpRaven.csproj">
112122
<Project>{36fcaf4d-911d-41a8-8303-e31527d3149f}</Project>
113123
<Name>SharpRaven</Name>
124+
<AdditionalProperties>TargetFramework=net40</AdditionalProperties>
114125
</ProjectReference>
115126
<ProjectReference Include="..\BridgeVs.Shared\BridgeVs.Shared.csproj">
116127
<Project>{bc10f93a-5da2-44f8-ae5e-5603cb46b548}</Project>

Src/BridgeVs.DynamicVisualizers/DynamicDebuggerVisualizer.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace BridgeVs.DynamicVisualizers
4949
public class DynamicDebuggerVisualizer : DialogDebuggerVisualizer
5050
{
5151
private const int SwShowNormal = 1;
52-
52+
5353
/// <summary>
5454
/// Deploys the dynamically generated linq script.
5555
/// </summary>
@@ -70,14 +70,14 @@ internal string DeployLinqScript(Message message, string vsVersion)
7070
FS.FileSystem.Directory.CreateDirectory(targetFolder);
7171

7272
string fileName = FindAvailableFileName(targetFolder, message.FileName);
73-
73+
7474
Log.Write("linqPadScriptPath: {0}", fileName);
7575

7676
Inspection linqQuery = new Inspection(message);
7777
string linqQueryText = linqQuery.TransformText();
7878

7979
FS.FileSystem.File.WriteAllText(fileName, linqQueryText);
80-
80+
8181
Log.Write("LinqQuery Successfully deployed");
8282

8383
return fileName;
@@ -186,9 +186,9 @@ private static Message GetMessage(IVisualizerObjectProvider objectProvider)
186186
if (dataStream.Length == 0)
187187
return null;
188188

189-
BinaryFormatter formatter = new BinaryFormatter();
190-
Message message = (Message)formatter.Deserialize(dataStream);
191-
189+
BinaryFormatter f = new BinaryFormatter();
190+
Message message = (Message)f.Deserialize(dataStream);
191+
192192
Log.Write($"Message content - \t {message}");
193193

194194
return message;

Src/BridgeVs.DynamicVisualizers/Template/Inspection.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was generated by a tool.
4-
// Runtime Version: 15.0.0.0
4+
// Runtime Version: 16.0.0.0
55
//
66
// Changes to this file may cause incorrect behavior and will be lost if
77
// the code is regenerated.
@@ -19,7 +19,7 @@ namespace BridgeVs.DynamicVisualizers.Template
1919
/// </summary>
2020

2121
#line 1 "C:\Users\Jarvis\Documents\GitHub\LINQBridgeVs\Src\BridgeVs.DynamicVisualizers\Template\Inspection.tt"
22-
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "15.0.0.0")]
22+
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "16.0.0.0")]
2323
public partial class Inspection : InspectionBase
2424
{
2525
#line hidden
@@ -106,7 +106,7 @@ public virtual string TransformText()
106106
/// <summary>
107107
/// Base class for this transformation
108108
/// </summary>
109-
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "15.0.0.0")]
109+
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "16.0.0.0")]
110110
public class InspectionBase
111111
{
112112
#region Fields
+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<runtime>
44
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
55
<dependentAssembly>
6-
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
7-
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
6+
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
7+
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0"/>
88
</dependentAssembly>
99
</assemblyBinding>
1010
</runtime>
11-
</configuration>
11+
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net40" />
3+
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net40" requireReinstallation="true" />
44
<package id="System.IO.Abstractions" version="2.1.0.256" targetFramework="net40" />
5+
<package id="System.Threading.Tasks.Extensions" version="4.3.0" targetFramework="net45" />
6+
<package id="System.ValueTuple" version="4.3.0" targetFramework="net45" />
57
</packages>

0 commit comments

Comments
 (0)