Template Wizards, IWizard Interface - GetService?

Jaeden Ruiner 126 Reputation points
2023-01-20T22:04:24.5466667+00:00

Okay,

I'm a little frustrated. Migrated to many versions of the TemplateWizardInterface which broke my stuff. Now, I wanted to be on the latest versions of everything but that broke VS2019, and I need to maintain both 2019 and evolve to 2022, but that is at a later date.

Currently I've completely reverted to following NuGet packages:

  • EnvDTE (8.0.1)
  • EnvDTE80 (8.0.1)
  • VSSDK.TemplateWizardInterface (12.0.4)
  • Nuget.VisualStudio (5.11.3)

This now works just fine as it always has.

However, in the IWizard interface there are a series of methods. The primary one being RunStarted() which passes in an "automationObject". This is just a type Object which must be cast to something.

Now, as you can see I am also referencing the Nuget.VisualStudio package, which has certain interfaces.

Most references I find on the Internet reference calling:

IVsPackageInstaller installer = GetService<IVsPackageInstaller>();

However, there is no method "GetService". That's on an IServiceProvider, or the IComponentModel for the modern libraries, which I do not have access to.

So, from the IWizard interface, how do I access a IServiceProvider or other such means in order to get a reference to the Nuget.VisualStudio objects?

Thanks

Jaeden "Sifo Dyas" al'Raec Ruiner

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,196 questions
Visual Studio Extensions
Visual Studio Extensions
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Extensions: A program or program module that adds functionality to or extends the effectiveness of a program.
227 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.