Skip to content

Commit

Permalink
Merge pull request #2917 from VsVim/dev/jaredpar/vs2022
Browse files Browse the repository at this point in the history
VS 2022 Support
  • Loading branch information
jaredpar committed Jul 31, 2021
2 parents b53e5d7 + 19a7b09 commit 70477d3
Show file tree
Hide file tree
Showing 52 changed files with 510 additions and 111 deletions.
6 changes: 2 additions & 4 deletions Directory.Build.props
Expand Up @@ -9,10 +9,7 @@
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<OutputPath>$(BinariesPath)$(Configuration)\$(MSBuildProjectName)</OutputPath>
<BaseIntermediateOutputPath>$(BinariesPath)obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>

<!-- The version of VS that should be targetted for testing for host agnostic projects. Prefer
the lowest supported Visual Studio version but allow changing via environment variable -->
<VsVimVisualStudioTargetVersion Condition="'$(VsVimVisualStudioTargetVersion)' == ''">16.0</VsVimVisualStudioTargetVersion>
<MicrosoftVsSdkBuildToolsVersion>17.0.2155-preview2</MicrosoftVsSdkBuildToolsVersion>

<!-- Standard Calculation of NuGet package location -->
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == ''">$(NUGET_PACKAGES)</NuGetPackageRoot> <!-- Respect environment variable if set -->
Expand All @@ -35,6 +32,7 @@
<ReferencePath>$(ReferencePath);$(MSBuildThisFileDirectory)References\Common</ReferencePath>
<ReferencePath>$(ReferencePath);$(MSBuildThisFileDirectory)References\Vs2017</ReferencePath>
<ReferencePath>$(ReferencePath);$(MSBuildThisFileDirectory)References\Vs2019</ReferencePath>
<ReferencePath>$(ReferencePath);$(MSBuildThisFileDirectory)References\Vs2022</ReferencePath>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildThisFileDirectory)</SolutionDir>

<!-- This controls the places MSBuild will consult to resolve assembly references. This is
Expand Down
9 changes: 9 additions & 0 deletions Directory.Build.targets
Expand Up @@ -7,11 +7,20 @@
<LangVersion Condition="'$(Language)' == 'C#'">Latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.0.2155-preview2" Condition="'$(VsVimProjectType)' == 'Vsix'" />
</ItemGroup>


<Import
Project="$(MSBuildThisFileDirectory)References\Vs2017\Vs2017.Build.targets"
Condition="'$(VsVimVisualStudioTargetVersion)' == '15.0' AND '$(VsVimProjectType)' != ''" />

<Import
Project="$(MSBuildThisFileDirectory)References\Vs2019\Vs2019.Build.targets"
Condition="'$(VsVimVisualStudioTargetVersion)' == '16.0' AND '$(VsVimProjectType)' != ''" />

<Import
Project="$(MSBuildThisFileDirectory)References\Vs2022\Vs2022.Build.targets"
Condition="'$(VsVimVisualStudioTargetVersion)' == '17.0' AND '$(VsVimProjectType)' != ''" />
</Project>
5 changes: 1 addition & 4 deletions References/Vs2017/Vs2017.Build.targets
Expand Up @@ -7,10 +7,6 @@
<DefineConstants Condition="'$(VsVimProjectType)' == 'EditorHost'">$(DefineConstants);VIM_SPECIFIC_TEST_HOST</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="16.10.1055" Condition="'$(VsVimProjectType)' == 'Vsix'" />
</ItemGroup>

<ItemGroup>
<!--
By using the 2.10.0.0 versions here this essentially limits VsVim to the 15.10 release. That is probably
Expand Down Expand Up @@ -55,6 +51,7 @@
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>

<Reference Include="Microsoft.VisualStudio.TextManager.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="Microsoft.VisualStudio.Text.Internal, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.Platform.VSEditor, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.Platform.VSEditor.Interop, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
Expand Down
2 changes: 1 addition & 1 deletion References/Vs2019/Vs2019.Build.targets
Expand Up @@ -12,7 +12,6 @@
<PackageReference Include="Microsoft.VisualStudio.Sdk.EmbedInteropTypes" Version="15.0.36" ExcludeAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="3.0.0" />
<PackageReference Include="Microsoft.VisualStudio.TextManager.Interop.10.0" Version="16.7.30328.74" />
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="16.10.1055" Condition="'$(VsVimProjectType)' == 'Vsix'" />

<!--
These are private assemblies and not typically considered as a part of the official VS SDK. But
Expand All @@ -28,6 +27,7 @@
</Reference>
<Reference Include="Microsoft.VisualStudio.Platform.VSEditor, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.Text.Internal, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.TextManager.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

<None Include="$(MSBuildThisFileDirectory)App.config">
<Link>app.config</Link>
Expand Down
9 changes: 9 additions & 0 deletions References/Vs2022/App.config
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="xunit.diagnosticMessages" value="false"/>
<add key="xunit.parallelizeTestCollections" value="false"/>
<add key="xunit.shadowCopy" value="false"/> <!-- Set shadow copy to false so that the VS Test Explorer can properly load our public signed binaries -->
<add key="xunit.longRunningTestSeconds" value="10"/>
</appSettings>
</configuration>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
35 changes: 35 additions & 0 deletions References/Vs2022/Vs2022.Build.targets
@@ -0,0 +1,35 @@
<Project>

<Import Project="$(MSBuildThisFileDirectory)..\..\Src\VimEditorHost\VimEditorHost.projitems" Label="Shared" Condition="'$(VsVimProjectType)' == 'EditorHost'" />

<PropertyGroup>
<DefineConstants>$(DefineConstants);VS_SPECIFIC_2022</DefineConstants>
<DefineConstants Condition="'$(VsVimProjectType)' == 'EditorHost'">$(DefineConstants);VIM_SPECIFIC_TEST_HOST</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Sdk" Version="17.0.0-previews-2-31512-422" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.0.0-1.final" />

<!--
These are private assemblies and not typically considered as a part of the official VS SDK. But
they are needed for some of the window / tab management code hence are used here -->
<Reference Include="Microsoft.VisualStudio.Platform.WindowManagement, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.Shell.ViewManager, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.Diagnostics.Assert, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>

<ItemGroup Condition="'$(VsVimProjectType)' == 'EditorHost'">
<Reference Include="Microsoft.VisualStudio.Setup.Configuration.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.VisualStudio.Platform.VSEditor, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.Text.Internal, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />

<None Include="$(MSBuildThisFileDirectory)App.config">
<Link>app.config</Link>
</None>
</ItemGroup>

<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VsVimProjectType)' == 'Vsix' AND '$(VSToolsPath)' != ''" />
</Project>
12 changes: 12 additions & 0 deletions References/Vs2022/update.ps1
@@ -0,0 +1,12 @@
$src = "C:\Program Files\Microsoft Visual Studio\2022\Public Preview"
$all = @(
"Common7\IDE\Microsoft.VisualStudio.Platform.WindowManagement.dll",
"Common7\IDE\Microsoft.VisualStudio.Shell.ViewManager.dll",
"Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.Diagnostics.Assert.dll",
"Common7\IDE\CommonExtensions\Microsoft\Editor\Microsoft.VisualStudio.Platform.VSEditor.dll",
"Common7\IDE\CommonExtensions\Microsoft\Editor\Microsoft.VisualStudio.Text.Internal.dll"
)

foreach ($item in $all) {
Copy-Item (Join-Path $src $item)
}
2 changes: 1 addition & 1 deletion Scripts/Build.ps1
Expand Up @@ -23,7 +23,7 @@ $ErrorActionPreference="Stop"
[string]$deployDir = Join-Path $binariesDir "Deploy"
[string]$logsDir = Join-Path $binariesDir "Logs"
[string]$toolsDir = Join-Path $rootDir "Tools"
[string[]]$vsVersions = @("2017", "2019")
[string[]]$vsVersions = @("2017", "2019", "2022")

function Print-Usage() {
Write-Host "Actions:"
Expand Down
3 changes: 1 addition & 2 deletions Src/VimApp/VimApp.csproj
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PlatformTarget>x86</PlatformTarget>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>VimApp</RootNamespace>
<AssemblyName>VimApp</AssemblyName>
<TargetFramework>net472</TargetFramework>
<DefineConstants>$(DefineConstants);VS_SPECIFIC_VIM_APP</DefineConstants>
<VsVimVisualStudioTargetVersion>17.0</VsVimVisualStudioTargetVersion>
<VsVimProjectType>EditorHost</VsVimProjectType>
<!-- Enabling tracked by https://github.com/VsVim/VsVim/issues/2904 -->
<RunAnalyzers>false</RunAnalyzers>
Expand All @@ -33,7 +33,6 @@
<ItemGroup>
<ProjectReference Include="..\VimCore\VimCore.fsproj" />
<ProjectReference Include="..\VimTestUtils\VimTestUtils.csproj" />
<Reference Include="Microsoft.VisualStudio.TextManager.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="Microsoft.VisualStudio.Setup.Configuration.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
Expand Down
2 changes: 1 addition & 1 deletion Src/VimApp/VimAppJoinableTaskFactoryProvider.cs
Expand Up @@ -25,7 +25,7 @@ internal VimAppJoinableTaskFactoryProvider()
{
#if VS_SPECIFIC_2017
s_joinableTaskContext = new JoinableTaskContext();
#elif VS_SPECIFIC_2019
#elif VS_SPECIFIC_2019 || VS_SPECIFIC_2022
s_joinableTaskContext = ThreadHelper.JoinableTaskContext;
#else
#error Unsupported configuration
Expand Down
2 changes: 2 additions & 0 deletions Src/VimCore/AssemblyInfo.fs
Expand Up @@ -8,8 +8,10 @@ open System.Runtime.CompilerServices
[<assembly:Extension()>]
[<assembly:InternalsVisibleTo("Vim.Core.2017.UnitTest")>]
[<assembly:InternalsVisibleTo("Vim.Core.2019.UnitTest")>]
[<assembly:InternalsVisibleTo("Vim.Core.2022.UnitTest")>]
[<assembly:InternalsVisibleTo("Vim.VisualStudio.Shared.2017.UnitTest")>]
[<assembly:InternalsVisibleTo("Vim.VisualStudio.Shared.2019.UnitTest")>]
[<assembly:InternalsVisibleTo("Vim.VisualStudio.Shared.2022.UnitTest")>]
[<assembly:InternalsVisibleTo("Vim.UnitTest.Utils")>]
[<assembly:InternalsVisibleTo("VimApp")>]
[<assembly:InternalsVisibleTo("DynamicProxyGenAssembly2")>] // Moq
Expand Down
2 changes: 1 addition & 1 deletion Src/VimEditorHost/EditorSpecificUtil.cs
Expand Up @@ -8,7 +8,7 @@ public static class EditorSpecificUtil
{
#if VS_SPECIFIC_2017
public const bool HasAsyncCompletion = false;
#elif VS_SPECIFIC_2019 || VS_SPECIFIC_MAC
#elif VS_SPECIFIC_2019 || VS_SPECIFIC_2022 || VS_SPECIFIC_MAC
public const bool HasAsyncCompletion = true;
#else
#error Unsupported configuration
Expand Down
1 change: 1 addition & 0 deletions Src/VimEditorHost/EditorVersion.cs
Expand Up @@ -13,5 +13,6 @@ public enum EditorVersion
{
Vs2017,
Vs2019,
Vs2022,
}
}

0 comments on commit 70477d3

Please sign in to comment.