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

Make extension compatible with VS2022 #342

Merged
merged 9 commits into from Nov 14, 2021
Merged

Conversation

virzak
Copy link
Contributor

@virzak virzak commented Jun 17, 2021

Description:

Fixes #353

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested my changes by running the extension in VS2017
  • I have tested my changes by running the extension in VS2019
  • I have tested my changes by running the extension in VS2022
  • If changes to the documentation are needed, I have noted this in the description above

@virzak virzak marked this pull request as ready for review June 17, 2021 23:46
@virzak
Copy link
Contributor Author

virzak commented Jun 18, 2021

Following the upgrade instructions for upgrading the extension, I'm running into an issue with VS2022

SetSite failed for package [StylerPackage]Source: 'XamlStyler.Extension.Windows' Description: Method not found: 'EnvDTE.Events EnvDTE._DTE.get_Events()'.
System.MissingMethodException: Method not found: 'EnvDTE.Events EnvDTE._DTE.get_Events()'.
   at Xavalon.XamlStyler.Extension.Windows.StylerPackage.AddCommandHandlers()
   at Xavalon.XamlStyler.Extension.Windows.StylerPackage.<InitializeAsync>d__12.MoveNext()

Upgrading a single package causes compile errors.

error CS0433: The type 'IVsUIShell' exists in both 'Microsoft.VisualStudio.Interop, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'Microsoft.VisualStudio.Shell.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

If all packages are upgraded to their latest versions, I then get VS2019 errors:

    CreateInstance failed for package [StylerPackage]Source: 'mscorlib' Description: Could not load file or assembly 'Microsoft.VisualStudio.Shell.15.0, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Shell.15.0, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.VisualStudio.Shell.15.0, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

Anyone has a suggestion?

cc @madskristensen

@virzak
Copy link
Contributor Author

virzak commented Jun 19, 2021

"... even if you have a regular command and you do text changes in you before query status ... you will need to do the split"

https://youtu.be/-PKIPTW6km0?t=5688

Doesn't seem like spit can be avoided here:

this.saveCommandEvents = this.IDE.Events.CommandEvents[$"{{{Guids.GuidVsStd97CmdIDString}}}", 331];
this.saveCommandEvents.BeforeExecute += this.OnFileSave;

The error was:

SetSite failed for package [StylerPackage]Source: 'XamlStyler.Extension.Windows' Description: Method not found: 'Void EnvDTE._dispCommandEvents_BeforeExecuteEventHandler..ctor(System.Object, UIntPtr)'.
System.MissingMethodException: Method not found: 'Void EnvDTE._dispCommandEvents_BeforeExecuteEventHandler..ctor(System.Object, UIntPtr)'.
   at Xavalon.XamlStyler.Extension.Windows.StylerPackage.AddCommandHandlers()
   at Xavalon.XamlStyler.Extension.Windows.StylerPackage.<InitializeAsync>d__12.MoveNext()

@NicoVermeir
Copy link
Contributor

Hi @virzak thanks a lot for your contribution, we appreciate it!
Allow us some time to look into the new extension model for VS2022 and how / if the marketplace can support multiple packages under one listing. We should be able to get back to you next week.

thanks again!

@jamers99
Copy link

Any update on this?
I've downloaded the vsix from the artifacts in the meantime: https://dev.azure.com/xavalon/XAML%20Styler/_build/results?buildId=401&view=artifacts&type=publishedArtifacts

@NicoVermeir
Copy link
Contributor

@jamers99 not yet, sorry for the delay. I'll look into it tomorrow, thanks for the push!

@alski
Copy link

alski commented Jul 6, 2021

@jamers99 Thanks for the suggestion, I am also now running from the same VSIX

@shawyunz
Copy link

Any update on this? Will fix #344

@Chips1234
Copy link

Are there any updates with this PR? Thanks

@NicoVermeir
Copy link
Contributor

Thanks for the patience everyone.
We have discussed this and have decided to not push a VS2022 version to the marketplace just yet. We would have to create a new entry in the marketplace for this version and would prefer not to. We want to wait and see how / if the Visual Studio gallery will be updated to support multiple vsix files for the same extension.

For now the download from the artifacts can be used for VS2022 support:
https://dev.azure.com/xavalon/XAML%20Styler/_build/results?buildId=401&view=artifacts&type=publishedArtifacts

@Chips1234
Copy link

Chips1234 commented Aug 12, 2021 via email

@grochocki grochocki changed the base branch from master to vs2022 November 14, 2021 03:36
@grochocki
Copy link
Contributor

Thanks, @virzak! I've been debugging this branch, and I need to make a few changes to prep for release, so merging this into a feature branch to capture these changes and will add a few deltas there.

@grochocki grochocki merged commit 882cf93 into Xavalon:vs2022 Nov 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Visual Studio 2022 Support
7 participants