xps / VSTextMacros

An extension for Visual Studio 2012-2022 that brings back support for macros in text/code editors
https://marketplace.visualstudio.com/items?itemName=XavierPoinas.TextMacrosforVisualStudio201220132015
Other
69 stars 20 forks source link

Add compatibility for VS 2019 #30

Closed xps closed 5 years ago

xps commented 5 years ago

Might be as simple as updating the list of compatible versions, or not.

ygoe commented 5 years ago

I've modified the vsix file but it won't install. Not sure what the problem is, this has worked so many times before, also with other extensions from VS 2017 for VS 2019. I'd appreciate this extension to continue to be available for VS 2019. Otherwise, I'd have to cut&paste out into Notepad++ again.

ygoe commented 5 years ago

The source code also doesn't build anymore. VS 2015 can't open it (needs a newer version) and VS 2017 and 2019 can't compile it because they can't find the COM components EnvDTE, EnvDTE80, EnvDTE90 and Microsoft.VisualStudio.CommandBars. Are there any build instructions available?

xps commented 5 years ago

Thanks for looking into it, @ygoe. I'm sorry I don't have time to look into it myself at the moment. I don't know about VS 2015 but I have no problem building with VS 2017.

envdte.dll should be picked up from the solution's root directory. There are other dependencies that are installed as NuGet packages, so make sure they are restored (should happen automatically as part of the build).

As far as I know the only requirement to build is VS 2017 + the Visual Studio SDK (installed as part of the "Visual Studio extension development" workload in the Visual Studio installer).

ygoe commented 5 years ago

Well, whatever it is, it doesn't work and I don't understand COM or ActiveX. Yes, there is a file envdte.dll and it seems to be referenced according to the reference properties, but the compiler says something else. I've tried to build for x86 instead of Any CPU as suggested by the error message but it doesn't help.

The VS Extension workload is installed and packages are restored. There seems to be some other dependency that's unknown.

Somehow I don't like native code. There's always trouble like this with weird compiler errors and specific dependencies. Managed code just works way more often. But I guess Visual Studio extensions depend on native libraries so there's no way around that. Unfortunately I'm no help when it comes to that stuff.

There are updates for NuGet packages available. VS has a weird error showing all packages twice with different versions. Upgrading fails because it can't find some dependency, I didn't understand the reason of the message. All in all, I can't make any use of the source code.

viniciusvillas commented 5 years ago

Just made it work with VS 2019 on my fork: https://github.com/viniciusvillas/VSTextMacros

Also converted it to an Async Package as shown here: https://github.com/Microsoft/VSSDK-Extensibility-Samples/tree/master/AsyncPackageMigration (only because VS 2019 shows a very annoying warning about synchronous packages being loaded)

Please note that what I did was only making the necessary changes to make it install and work in VS 2019 (took me about 10 min, so I didn't look closely to the code). I didn't test it on previous VS versions and I really think that I broke compatibility to earlier versions. TBH, I just tested Ctrl+Shift+R and Ctrl+Shift+P in VS 2019 and it worked, so it's already good enough for me. Use at your own discretion.

chris-ray commented 5 years ago

+1

ygoe commented 5 years ago

@xps Hey there, this has been open for a while and VS2019 is probably more widespread than VS2017 now. Is there any news on publishing a new version in the extension gallery so it's easily accessible for everyone without having to find their way to GitHub and build custom stuff?

xps commented 5 years ago

I tried @viniciusvillas' version (thanks for that!) but unfortunately it doesn't work on Visual Studio 2017. So now I have to decide to break backwards compatibility (that currently goes all the way back to Visual Studio 2012), or publish the updated version as a brand new extension, which will make it hard to discover.

ygoe commented 5 years ago

Well, I've seen several extensions specific for each Visual Studio version, so that doesn't seem too uncommon if it's technically required. You could add cross-links in their descriptions like others do. Right now the extension is 0% discoverable for VS2019 because it doesn't exist.

chris-ray commented 5 years ago

I agree that version specific is OK if it is necessary. Not hard for someone to find one or the other especially with cross links.

This is easily my favorite extension for VS, use it every day. Built @viniciusvillas version from source and have been using that. Would be great if the published version worked out of box. Thanks for your work on this

xps commented 5 years ago

The new version with support for VS 2019 has been uploaded to the Visual Studio marketplace.

I opted to upload over the older version and provide a link in the description for those who want to download the last version that is compatible with VS 2012-2017.

Thanks everyone for your contributions and feedback.