Detecting Version/Edition of Visual Studio

Topics: General
Sep 24, 2012 at 5:45 PM

Is it possible to detect version and edition of Visual Studio (perhaps from the init.ps1 script?) and gracefully abort package installation if they don't meet package requirements?

Thanks,
Oleg

Sep 24, 2012 at 9:00 PM

You can detect VS version with the DTE.Version property, and edition with DTE.Edition.

If you want to abort package installation from inside init.ps1, just throw an exception.

Sep 25, 2012 at 12:14 AM

Thanks! Would it be correct to assume that the $DTE variable is always initialized in the init.ps1?

Sep 25, 2012 at 12:34 AM

Yes