Skip to content

Commit

Permalink
More WIP on VS2022 - works
Browse files Browse the repository at this point in the history
  • Loading branch information
zpqrtbnk committed Jul 23, 2021
1 parent 2f345db commit e149a60
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 69 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
-->

<VersionPrefix>1.2.4</VersionPrefix>
<VersionRevision>11</VersionRevision>
<VersionRevision>15</VersionRevision>
<VersionSuffix></VersionSuffix>

<Authors>Pilotine / Stephane Gay / ZpqrtBnk</Authors>
Expand Down
24 changes: 12 additions & 12 deletions SolutionBook.2019/SolutionBook.2019.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@
<MinimumVisualStudioVersion>16.0</MinimumVisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug 2019|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>8.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Configuration Condition=" '$(Configuration)' == '' ">Debug 2019</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Expand All @@ -27,15 +36,6 @@
<StartProgram Condition="'$(DevEnvDir)' != ''">$(DevEnvDir)devenv.exe</StartProgram>
<StartArguments>/rootsuffix Exp</StartArguments>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
Expand All @@ -57,7 +57,7 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Design" />
<Reference Include="System.Drawing" />
Expand All @@ -84,7 +84,7 @@
</ItemGroup>
<Import Project="..\SolutionBook\SolutionBook.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<Target Name="BeforeBuild">
<Message Text="BeforeBuild" Importance="High" />
</Target>
Expand Down
29 changes: 15 additions & 14 deletions SolutionBook.2022/SolutionBook.2022.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@
<MinimumVisualStudioVersion>16.0</MinimumVisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug 2022|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>8.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Configuration Condition=" '$(Configuration)' == '' ">Debug 2022</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Expand All @@ -16,25 +25,17 @@
<RootNamespace>SolutionBook</RootNamespace>
<AssemblyName>SolutionBook</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<GeneratePkgDefFile>false</GeneratePkgDefFile>
<IncludeAssemblyInVSIXContainer>false</IncludeAssemblyInVSIXContainer>
<GeneratePkgDefFile>true</GeneratePkgDefFile>
<UseCodebase>true</UseCodebase>
<IncludeAssemblyInVSIXContainer>true</IncludeAssemblyInVSIXContainer>
<IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
<CopyBuildOutputToOutputDirectory>true</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>true</CopyOutputSymbolsToOutputDirectory>
<StartAction>Program</StartAction>
<StartProgram Condition="'$(DevEnvDir)' != ''">$(DevEnvDir)devenv.exe</StartProgram>
<StartArguments>/rootsuffix Exp</StartArguments>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
Expand Down
2 changes: 1 addition & 1 deletion SolutionBook.2022/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
</Dependencies>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[16.0,18.0)" DisplayName="Visual Studio core editor" />
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[17.0,18.0)" DisplayName="Visual Studio core editor" />
</Prerequisites>
<Assets>
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
Expand Down
12 changes: 8 additions & 4 deletions SolutionBook.sln
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,19 @@ Global
SolutionBook\SolutionBook.projitems*{d80e486e-6b7c-4652-86d7-62772afab884}*SharedItemsImports = 13
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug 2019|Any CPU = Debug 2019|Any CPU
Debug 2022|Any CPU = Debug 2022|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7050C591-2B7C-4C46-9902-E20FD0531599}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7050C591-2B7C-4C46-9902-E20FD0531599}.Debug 2019|Any CPU.ActiveCfg = Debug 2019|Any CPU
{7050C591-2B7C-4C46-9902-E20FD0531599}.Debug 2019|Any CPU.Build.0 = Debug 2019|Any CPU
{7050C591-2B7C-4C46-9902-E20FD0531599}.Debug 2022|Any CPU.ActiveCfg = Debug 2022|Any CPU
{7050C591-2B7C-4C46-9902-E20FD0531599}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7050C591-2B7C-4C46-9902-E20FD0531599}.Release|Any CPU.Build.0 = Release|Any CPU
{1A72DCD0-72C9-4041-A7C2-8022A676062A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1A72DCD0-72C9-4041-A7C2-8022A676062A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A72DCD0-72C9-4041-A7C2-8022A676062A}.Debug 2019|Any CPU.ActiveCfg = Debug 2022|Any CPU
{1A72DCD0-72C9-4041-A7C2-8022A676062A}.Debug 2022|Any CPU.ActiveCfg = Debug 2022|Any CPU
{1A72DCD0-72C9-4041-A7C2-8022A676062A}.Debug 2022|Any CPU.Build.0 = Debug 2022|Any CPU
{1A72DCD0-72C9-4041-A7C2-8022A676062A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A72DCD0-72C9-4041-A7C2-8022A676062A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
Expand Down
8 changes: 1 addition & 7 deletions SolutionBook/Solutions.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using EnvDTE;
using System;
using System.IO;
using Microsoft.VisualStudio.Shell;
using System.ComponentModel;
using System.Windows.Data;

namespace SolutionBook
{
Expand All @@ -30,12 +28,8 @@ public Solutions(DTE dte) // requires the UI thread

_canOpen = !_dte.Solution.IsOpen;

// FIXME
// - the DTE events below do not seem to trigger?!
// - the binding to CanOpen/CanClose does not work

// see: https://docs.microsoft.com/en-us/dotnet/api/envdte.solutionevents?redirectedfrom=MSDN&view=visualstudiosdk-2019
// keep the _solutionEvents around else it's GC and we miss events
// keep the _solutionEvents around else it's GC-ed and we miss events

_solutionEvents = _dte.Events.SolutionEvents;
_solutionEvents.Opened += () => CanOpen = false;
Expand Down
60 changes: 30 additions & 30 deletions SolutionBook/ToolWindowControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,16 @@ private async Task LoadAsync()
}
}

private void CarryExpand(IEnumerable<BookItem> source, IEnumerable<BookItem> target)
private static void CarryExpand(IEnumerable<BookItem> source, IEnumerable<BookItem> target)
{
var sourceItems = source.ToDictionary(x => x.Header, x => x);

foreach (var targetItem in target)
{
if (sourceItems.TryGetValue(targetItem.Header, out var sourceItem))
{
targetItem.IsExpanded = sourceItem.IsExpanded;
CarryExpand(sourceItem.Items, targetItem.Items);
}
if (!sourceItems.TryGetValue(targetItem.Header, out var sourceItem)) continue;

targetItem.IsExpanded = sourceItem.IsExpanded;
CarryExpand(sourceItem.Items, targetItem.Items);
}
}

Expand Down Expand Up @@ -239,7 +238,9 @@ private void Menu_AddFolder(object sender, RoutedEventArgs e)
bookItem.Items.Add(new BookItem(bookItem, BookItemType.Folder) { Header = "(new folder)" });
}
finally { _booksem.Release(); }
//Save();


TriggerSave();
}

private void Menu_AddSolution(object sender, RoutedEventArgs e)
Expand All @@ -252,8 +253,7 @@ private void Menu_AddSolution(object sender, RoutedEventArgs e)
CheckFileExists = true,
CheckPathExists = true,
DefaultExt = ".sln",
Filter = @"Solution (*.sln)|*.sln"
/*+ @"|All files (*.*)|*.*"*/,
Filter = @"Solution (*.sln)|*.sln" /*+ @"|All files (*.*)|*.*"*/,
AddExtension = true,
Multiselect = false,
ValidateNames = true,
Expand All @@ -264,16 +264,16 @@ private void Menu_AddSolution(object sender, RoutedEventArgs e)
? dialog.FileName
: null;

if (path != null)
if (path == null) return;

_booksem.Wait();
try
{
_booksem.Wait();
try
{
bookItem.Items.Add(new BookItem(bookItem, BookItemType.Solution, path) { Header = Path.GetFileNameWithoutExtension(path) });
}
finally { _booksem.Release(); }
//Save();
bookItem.Items.Add(new BookItem(bookItem, BookItemType.Solution, path) { Header = Path.GetFileNameWithoutExtension(path) });
}
finally { _booksem.Release(); }

TriggerSave();
}

private void Menu_RemoveFolder(object sender, RoutedEventArgs e)
Expand All @@ -292,7 +292,7 @@ private void Menu_RemoveFolder(object sender, RoutedEventArgs e)
}
finally { _booksem.Release(); }

//Save();
TriggerSave();
}

private void Menu_RemoveSolution(object sender, RoutedEventArgs e)
Expand All @@ -311,7 +311,7 @@ private void Menu_RemoveSolution(object sender, RoutedEventArgs e)
}
finally { _booksem.Release(); }

//Save();
TriggerSave();
}

private void Book_PreviewMouseLeftDown(object sender, MouseButtonEventArgs e)
Expand Down Expand Up @@ -503,7 +503,7 @@ private void DoDrop(DragDropEffects effect)
_targetRelative = 0;
_sourceItem = null;

//Save();
TriggerSave();
}

private DragDropEffects DragDropEffect
Expand Down Expand Up @@ -818,7 +818,8 @@ private void AddRootFolder_Click(object sender, RoutedEventArgs e)
Book.Items.Add(new BookItem(null, BookItemType.Folder) { Header = "(new folder)" });
}
finally { _booksem.Release(); }
//Save();

TriggerSave();
}

private void AddRootSolution_Click(object sender, RoutedEventArgs e)
Expand All @@ -841,17 +842,16 @@ private void AddRootSolution_Click(object sender, RoutedEventArgs e)
? dialog.FileName
: null;

if (path != null)
{
_booksem.Wait();
try
{
Book.Items.Add(new BookItem(null, BookItemType.Solution, path) { Header = Path.GetFileNameWithoutExtension(path) });
}
finally { _booksem.Release(); }
if (path == null) return;

//Save();
_booksem.Wait();
try
{
Book.Items.Add(new BookItem(null, BookItemType.Solution, path) { Header = Path.GetFileNameWithoutExtension(path) });
}
finally { _booksem.Release(); }

TriggerSave();
}

private void Save_Click(object sender, RoutedEventArgs e) => TriggerSave();
Expand Down

0 comments on commit e149a60

Please sign in to comment.