Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VS2022 #75

Merged
merged 6 commits into from
Feb 2, 2022
Merged

VS2022 #75

merged 6 commits into from
Feb 2, 2022

Conversation

3F
Copy link
Owner

@3F 3F commented Dec 15, 2021

Extends support to modern VS2022.

Closes #76

+ SDK17
+ netfx4sdk since Microsoft officially dropped support of the Developer Pack (SDK) for .NET Framework 4.0.
+ Now SDK15 is limited to VS2017 and VS2019 only
+ Fixes SDK10 incorrect manifest for VS2010 9dfbec4


Problems

In addition to x64 feature, seems like we have an incompatible type binding using SDK15.

EnvDTE

EnvDTE reference from SDK15 just produces this at runtime evaluation in modern VS2022

{"Method not found: 'Void EnvDTE._dispCommandEvents_BeforeExecuteEventHandler..ctor(System.Object, UIntPtr)'."}

With public API use (exactly not a EnvDTE.dispCommandEvents internal use)

cmdEvents.BeforeExecute += OnCommandEventBefore;

That's weird because it can also be found at least for SDK15

Looks like it can be really due to .ctor(System.Object, UIntPtr) because of .ctor(System.Object, IntPtr) now.

Modern VSSDK Interop types

Microsoft aggregates now all their VSSDK Interop types inside single Microsoft.VisualStudio.Interop.dll

Before it was a separate assemblies here https://www.nuget.org/packages/EnvDTE and so on

Now Microsoft.VisualStudio.Interop can produce CS0433 because we are referencing legacy assemblies in SDK15 to make them work for VS2017+

SDK15 & SDK17

Today I really don't want to separate it for a new SDK17 distr (in additon to SDK10 and SDK15).
Thus we need to think how to make friends with modern Microsoft.VisualStudio.Interop etc.

Obviously Microsoft.VisualStudio.Shell.15.0 cannot be upgraded to modern versions (17+) without breaking in VS2019.
I've checked it.

So... why hasn't it been sliced into another layer of API such as Shell.17.0 and why at all Shell.15.0 v17.0.31902.203 targets VS2022 ... these are good questions to the team because this works well in VS2022 but crashes VS2019

Tl;dr

I'll try to review some SDK15/SDK17 combinations as soon as possible to complete this PR but any comments and suggestions are welcome.

FYI, at this moment you can still use our nuget package together with VS2022 which should work fine

Reviewed. Possible solutions

  1. ❌ Csc isolation of Microsoft.VisualStudio.Interop through aliases is difficult or impossible due to Shell.15 which reference EnvDTE. For example, I've checked some scenario when it really helps and everything works well (like CommandEvents subscription) but for overriding like GetAsyncToolWindowFactory I'm not really sure what to do without modifying the assembly to rebind types etc.
public override B.Microsoft.VisualStudio.Shell.Interop.IVsAsyncToolWindowFactory GetAsyncToolWindowFactory(Guid toolWindowType)
  1. ✅ To cut everything except EnvDTE/EnvDTE80 from Microsoft.VisualStudio.Interop is prohibited by license :( But I'm pretty sure for 90% that technically this is a working option in a just few clicks because, again, the main problem is the aggregation of unnecessary assemblies into one. At least for actual VS2022 version where crash indicates the error which 100% covers public API.

  2. ❌ To implement own EnvDTE (even to cover only used API in this project) will be more difficult thing than SDK17 support in addition to SDK15.

I come to the conclusion that I need to do SDK17 :( because I have no rights for item №2

damn

@3F 3F added this to the 1.15 milestone Dec 15, 2021
Microsoft.VisualStudio.SDK 17.0.32112.339

Microsoft.VSSDK.BuildTools 17.0.5234

AvalonEdit 6.1.3.50
This also fixes vsixmanifest for VS2010
Looks like it only understands local files in ReleaseNotes
@3F 3F changed the title WIP. VS2022 VS2022 Feb 2, 2022
@3F 3F merged commit ffe912d into master Feb 2, 2022
@3F 3F deleted the dev/vs2022 branch February 2, 2022 14:23
3F added a commit that referenced this pull request Feb 2, 2022
* NEW: Visual Studio 2022 support. SDK17. PR #75

* FIXED: MSBuild Properties not changing according to solution configuration.
         Issue #71

* FIXED: Fixed unexpected plugin deactivation in Visual Studio 2010.

* FIXED: Fixed incorrect format of new generated .sln for CIM.

* CHANGED: Updated the follwoing references:

    * MSBuild 17.0.0 for SDK15 and SDK17 only
      https://www.nuget.org/packages/Microsoft.Build/17.0.0

    * MvsSln 2.6.1
      https://github.com/3F/MvsSln/releases/tag/2.6.1

    * 7z.Libs 21.6.0
      https://github.com/3F/7z.Libs/releases/tag/21.6.0

    * Microsoft.VisualStudio.Interop 17.0.32112.339
      https://www.nuget.org/packages/Microsoft.VisualStudio.Interop/17.0.32112.339

    * NLog 4.7.13
      https://github.com/NLog/NLog/releases/tag/v4.7.13

    * AvalonEdit 6.1.3.50
      https://github.com/icsharpcode/AvalonEdit/releases/tag/v6.1.3

    * System.Runtime.CompilerServices.Unsafe 5.0.0
      https://go.microsoft.com/fwlink/?LinkID=799421

    * Newtonsoft.Json 13.0.1
      https://github.com/JamesNK/Newtonsoft.Json/releases/tag/13.0.1

    * LSender 1.16
      https://github.com/3F/LSender/releases/tag/1.16

* KNOWN: 7z: relative paths like ..\Dir for input files lead to wrong filename in zip file.
         Please follow the temporary solution described here:
         #70

* NOTE: Choose the package that suits your needs:

        *.vsix  - Visual Studio
        *.nupkg - MSBuild
        *.zip   - API, samples, etc.

        GitHub: https://github.com/3F/vsSolutionBuildEvent/releases/tag/1.15
        NuGet:  https://www.nuget.org/packages/vsSolutionBuildEvent/

        * SDK17: Visual Studio 2022+
        * SDK15: Visual Studio 2019, 2017
        * SDK10: Visual Studio 2017, 2015, 2013, 2012, 2010
3F added a commit to 3F/vsCommandEvent that referenced this pull request Feb 18, 2022
* NEW: Visual Studio 2022 support. SDK17.
       Related PR 3F/vsSolutionBuildEvent#75

* NEW: Extends events when a file is open from the solution explorer.
       Issue #5

* NEW: Added the ability to disable the CustomIn/CustomOut check.
       You can control parameters through script, for example:
       ```
        #[var v = #[DTE events.LastCommand.CustomOut]]
        ...
        $(v.Split(",")[0].Trim("{}"))
        == "Language":"CSharp"

        $(v.Split(",")[0].Trim("{}").Split(":")[1])
        == "CSharp"
       ```
       Details #7

* NEW: Extra events:
       Scope `@Document`     <- {2555243A-2A69-4335-BAD6-DDE9DFFE90F2}
       Scope `@OutputWindow` <- {600FCA14-172C-42F3-AC91-1BC5F32CF896}
       Scope `@Solution`     <- {AD4AD581-801F-4399-B986-27FE2D308BDD}
       Scope `@Window`       <- {69F5F698-996B-4293-9FE7-4202564FE6E5}
       Scope `@Debugger`     <- {4885535D-A7F9-46AB-A285-8E4D76F4C5B0}

* FIXED: Restored accidentally removed `raise` method in v1.3. Issue #6

* FIXED: MSBuild Properties not changing according to solution configuration.
         Related Issue 3F/vsSolutionBuildEvent#71

* FIXED: Fixed unexpected plugin deactivation in Visual Studio 2010.

* CHANGED: Updated the follwoing references:

    * MSBuild 17.0.0 for SDK15 and SDK17 only
      https://www.nuget.org/packages/Microsoft.Build/17.0.0

    * MvsSln 2.6.1
      https://github.com/3F/MvsSln/releases/tag/2.6.1

    * 7z.Libs 21.7.0
      https://github.com/3F/7z.Libs/releases/tag/21.7.0

    * Microsoft.VisualStudio.Interop 17.0.32112.339
      https://www.nuget.org/packages/Microsoft.VisualStudio.Interop/17.0.32112.339

    * NLog 4.7.13
      https://github.com/NLog/NLog/releases/tag/v4.7.13

    * AvalonEdit 6.1.3.50
      https://github.com/icsharpcode/AvalonEdit/releases/tag/v6.1.3

    * System.Runtime.CompilerServices.Unsafe 5.0.0
      https://go.microsoft.com/fwlink/?LinkID=799421

    * Newtonsoft.Json 13.0.1
      https://github.com/JamesNK/Newtonsoft.Json/releases/tag/13.0.1

    * LSender 1.16
      https://github.com/3F/LSender/releases/tag/1.16

* KNOWN: 7z: relative paths like ..\Dir for input files lead to wrong filename in zip file.
         Please follow the temporary solution described here:
         3F/vsSolutionBuildEvent#70

* NOTE: Choose the package that suits your needs:
        https://github.com/3F/vsSolutionBuildEvent/releases/tag/1.4

        * SDK17: Visual Studio 2022+
        * SDK15: Visual Studio 2019, 2017
        * SDK10: Visual Studio 2017, 2015, 2013, 2012, 2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Visual Studion 2022 support
1 participant