Skip to content

Commit f938d3a

Browse files
Updated to VS 2022 and latest toolkit version
1 parent a65bf1f commit f938d3a

11 files changed

+49
-31
lines changed

InsertGuid/Commands/MyCommand.cs

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
using System;
22
using Community.VisualStudio.Toolkit;
3-
using EnvDTE;
43
using Microsoft.VisualStudio.Shell;
5-
using Microsoft.VisualStudio.Text.Editor;
64
using Task = System.Threading.Tasks.Task;
75

86
namespace InsertGuid
@@ -12,10 +10,13 @@ internal sealed class MyCommand : BaseCommand<MyCommand>
1210
{
1311
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
1412
{
15-
IWpfTextView view = await VS.Documents.GetCurrentTextViewAsync();
16-
var position = view.Selection.Start.Position.Position;
13+
DocumentView docView = await VS.Documents.GetActiveDocumentViewAsync();
14+
var position = docView.TextView?.Selection.Start.Position.Position;
1715

18-
view.TextBuffer.Insert(position, Guid.NewGuid().ToString());
16+
if (position.HasValue)
17+
{
18+
docView.TextBuffer.Insert(position.Value, Guid.NewGuid().ToString());
19+
}
1920
}
2021
}
2122
}

InsertGuid/InsertGuid.csproj

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<PropertyGroup>
44
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
55
<LangVersion>9.0</LangVersion>
6+
<TargetFrameworkProfile />
67
</PropertyGroup>
78
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
89
<PropertyGroup>
@@ -15,7 +16,7 @@
1516
<AppDesignerFolder>Properties</AppDesignerFolder>
1617
<RootNamespace>InsertGuid</RootNamespace>
1718
<AssemblyName>InsertGuid</AssemblyName>
18-
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
19+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
1920
<GeneratePkgDefFile>true</GeneratePkgDefFile>
2021
<UseCodebase>true</UseCodebase>
2122
<IncludeAssemblyInVSIXContainer>true</IncludeAssemblyInVSIXContainer>
@@ -83,11 +84,14 @@
8384
<Reference Include="System.Design" />
8485
</ItemGroup>
8586
<ItemGroup>
86-
<PackageReference Include="Community.VisualStudio.Toolkit" Version="16.0.75.152-pre" ExcludeAssets="runtime">
87+
<PackageReference Include="Community.VisualStudio.Toolkit" Version="17.0.76.303" ExcludeAssets="runtime">
8788
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
8889
</PackageReference>
8990
<PackageReference Include="Community.VisualStudio.VSCT" Version="16.0.29.6" PrivateAssets="all" />
90-
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="16.10.11" />
91+
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.1.9-preview1">
92+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
93+
<PrivateAssets>all</PrivateAssets>
94+
</PackageReference>
9195
</ItemGroup>
9296
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
9397
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />

InsertGuid/source.extension.vsixmanifest

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
<PreviewImage>Resources\Icon.png</PreviewImage>
99
</Metadata>
1010
<Installation>
11-
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[16.0, 17.0)" />
11+
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0, 18.0)">
12+
<ProductArchitecture>amd64</ProductArchitecture>
13+
</InstallationTarget>
1214
</Installation>
1315
<Prerequisites>
14-
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[16.0,)" DisplayName="Visual Studio core editor" />
16+
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[17.0,)" DisplayName="Visual Studio core editor" />
1517
</Prerequisites>
1618
<Assets>
1719
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />

Options/Options.csproj

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<PropertyGroup>
44
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
55
<LangVersion>9.0</LangVersion>
6+
<TargetFrameworkProfile />
67
</PropertyGroup>
78
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
89
<PropertyGroup>
@@ -15,7 +16,7 @@
1516
<AppDesignerFolder>Properties</AppDesignerFolder>
1617
<RootNamespace>Options</RootNamespace>
1718
<AssemblyName>Options</AssemblyName>
18-
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
19+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
1920
<GeneratePkgDefFile>true</GeneratePkgDefFile>
2021
<UseCodebase>true</UseCodebase>
2122
<IncludeAssemblyInVSIXContainer>true</IncludeAssemblyInVSIXContainer>
@@ -84,11 +85,14 @@
8485
<Reference Include="System.Design" />
8586
</ItemGroup>
8687
<ItemGroup>
87-
<PackageReference Include="Community.VisualStudio.Toolkit" Version="16.0.75.152-pre" ExcludeAssets="Runtime">
88+
<PackageReference Include="Community.VisualStudio.Toolkit" Version="17.0.76.303" ExcludeAssets="Runtime">
8889
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
8990
</PackageReference>
9091
<PackageReference Include="Community.VisualStudio.VSCT" Version="16.0.29.6" PrivateAssets="all" />
91-
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="16.10.11" />
92+
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.1.9-preview1">
93+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
94+
<PrivateAssets>all</PrivateAssets>
95+
</PackageReference>
9296
</ItemGroup>
9397
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
9498
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />

Options/OptionsPackage.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
2323

2424
}
2525

26-
private void OnSettingsSaved(object sender, General e)
26+
private void OnSettingsSaved(General obj)
2727
{
2828

2929
}

Options/VSCommandTable.cs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
// ------------------------------------------------------------------------------
1+
// ------------------------------------------------------------------------------
22
// <auto-generated>
3-
// This file was generated by the free extension VSIX Synchronizer
3+
// This file was generated by VSIX Synchronizer
44
// </auto-generated>
55
// ------------------------------------------------------------------------------
6-
using System;
7-
86
namespace Options
97
{
8+
using System;
9+
1010
/// <summary>
1111
/// Helper class that exposes all GUIDs used across VS Package.
1212
/// </summary>
@@ -20,5 +20,6 @@ internal sealed partial class PackageGuids
2020
/// </summary>
2121
internal sealed partial class PackageIds
2222
{
23+
2324
}
2425
}

Options/source.extension.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
// ------------------------------------------------------------------------------
1+
// ------------------------------------------------------------------------------
22
// <auto-generated>
3-
// This file was generated by the extension VSIX Synchronizer
3+
// This file was generated by VSIX Synchronizer
44
// </auto-generated>
55
// ------------------------------------------------------------------------------
6-
76
namespace Options
87
{
98
internal sealed partial class Vsix

Options/source.extension.vsixmanifest

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
<PreviewImage>Resources\Icon.png</PreviewImage>
99
</Metadata>
1010
<Installation>
11-
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[16.0, 17.0)" />
11+
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0, 18.0)">
12+
<ProductArchitecture>amd64</ProductArchitecture>
13+
</InstallationTarget>
1214
</Installation>
1315
<Prerequisites>
14-
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[16.0,)" DisplayName="Visual Studio core editor" />
16+
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[17.0,)" DisplayName="Visual Studio core editor" />
1517
</Prerequisites>
1618
<Assets>
1719
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />

ToolWindow/ToolWindow.csproj

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<PropertyGroup>
44
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
55
<LangVersion>9.0</LangVersion>
6+
<TargetFrameworkProfile />
67
</PropertyGroup>
78
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
89
<PropertyGroup>
@@ -15,7 +16,7 @@
1516
<AppDesignerFolder>Properties</AppDesignerFolder>
1617
<RootNamespace>ToolWindow</RootNamespace>
1718
<AssemblyName>ToolWindow</AssemblyName>
18-
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
19+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
1920
<GeneratePkgDefFile>true</GeneratePkgDefFile>
2021
<UseCodebase>true</UseCodebase>
2122
<IncludeAssemblyInVSIXContainer>true</IncludeAssemblyInVSIXContainer>
@@ -96,11 +97,14 @@
9697
<Reference Include="WindowsBase" />
9798
</ItemGroup>
9899
<ItemGroup>
99-
<PackageReference Include="Community.VisualStudio.Toolkit" Version="16.0.75.152-pre" ExcludeAssets="Runtime">
100+
<PackageReference Include="Community.VisualStudio.Toolkit" Version="17.0.76.303" ExcludeAssets="Runtime">
100101
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
101102
</PackageReference>
102103
<PackageReference Include="Community.VisualStudio.VSCT" Version="16.0.29.6" PrivateAssets="all" />
103-
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="16.10.11" />
104+
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.1.9-preview1">
105+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
106+
<PrivateAssets>all</PrivateAssets>
107+
</PackageReference>
104108
</ItemGroup>
105109
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
106110
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />

ToolWindow/source.extension.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
// ------------------------------------------------------------------------------
1+
// ------------------------------------------------------------------------------
22
// <auto-generated>
3-
// This file was generated by the extension VSIX Synchronizer
3+
// This file was generated by VSIX Synchronizer
44
// </auto-generated>
55
// ------------------------------------------------------------------------------
6-
76
namespace ToolWindow
87
{
98
internal sealed partial class Vsix

ToolWindow/source.extension.vsixmanifest

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
<PreviewImage>Resources\Icon.png</PreviewImage>
99
</Metadata>
1010
<Installation>
11-
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[16.0, 17.0)" />
11+
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0, 18.0)">
12+
<ProductArchitecture>amd64</ProductArchitecture>
13+
</InstallationTarget>
1214
</Installation>
1315
<Prerequisites>
14-
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[16.0,)" DisplayName="Visual Studio core editor" />
16+
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[17.0,)" DisplayName="Visual Studio core editor" />
1517
</Prerequisites>
1618
<Assets>
1719
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />

0 commit comments

Comments
 (0)