madskristensen / DialToolsForVS

A Visual Studio extension
Other
50 stars 21 forks source link

Visual Studio 2022 support #37

Closed xperiandri closed 2 years ago

xperiandri commented 3 years ago

@madskristensen should I upgrade the existing csproj or do we need to have 2 projects in order to support the earlier versions of Visual Studio? And do we need to support them?

https://docs.microsoft.com/en-us/visualstudio/extensibility/migration/update-visual-studio-extension?view=vs-2022

madskristensen commented 3 years ago

Hopefully we just need to replace the use of the DTE with DTE2 and it will work in both versions

xperiandri commented 3 years ago

Without any changes to the project file? Just replace that, add target to manifest and that's it?

xperiandri commented 3 years ago

This is the only pace where DTE is referenced https://github.com/madskristensen/DialToolsForVS/blob/c0f47f4dcd625dfe2c6b9b44fb8ab87d3fd8c21b/src/Helpers/VsHelpers.cs#L19 All the other places use DTE2

xperiandri commented 3 years ago

System.MissingMethodException: 'Method not found: 'Int32 EnvDTE.Window.get_HWnd()'.'

xperiandri commented 3 years ago

I tried to cast to Window2 but exception is the same System.MissingMethodException: 'Method not found: 'Int32 EnvDTE80.Window2.get_HWnd()'.' @madskristensen any suggestions?

xperiandri commented 3 years ago
  <Installation>
    <InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[15.0.27130,17.0)" />
    <InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0,)">
      <ProductArchitecture>amd64</ProductArchitecture>
    </InstallationTarget>
  </Installation>
madskristensen commented 3 years ago

Use Application.Current.MainWindow instead

xperiandri commented 3 years ago

But debugger returns a value from that property. How can this happen?

madskristensen commented 3 years ago

Weird COM interop stuff from the move to 64bit

xperiandri commented 3 years ago

https://github.com/madskristensen/DialToolsForVS/blob/c0f47f4dcd625dfe2c6b9b44fb8ab87d3fd8c21b/src/Providers/Errors/ErrorsController.cs#L21 System.MissingMethodException: 'Method not found: 'Void EnvDTE._dispWindowEvents_WindowActivatedEventHandler..ctor(System.Object, UIntPtr)'.'

xperiandri commented 3 years ago

Pushed WIP to my repo

xperiandri commented 3 years ago

@madskristensen I've just watched your video Hacking Visual Studio - DTE2 compatibility in VS 2022 and updated the extension accordingly

xperiandri commented 2 years ago

@madskristensen maybe it is time to publish it for Visual Studio 2022 to the store?

xperiandri commented 2 years ago

Fixed in #41