Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSIX: execute code on VS startup

I'd like to call some code from VSIX extension when visual studio loads a solution, how do I do that? Package::Initialize is called only when user presses a button of my addin first time.

like image 680
Ivan G. Avatar asked Oct 19 '11 00:10

Ivan G.


People also ask

How do I use VSIX in Visual Studio?

vsix file by double-clicking the file or selecting the file and pressing Enter. After that, just follow the instructions. When the extension is installed, you can use the Manage Extensions dialog box to enable it, disable it, or uninstall it. Visual Studio Marketplace contains both VSIX and MSI extensions.

How do I run VSIX installer?

Steps: Open Developer Command Prompt for Visual Studio > type cd XXXX (replace XXXX with the path for example, for VS 2019 Community, C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE ) > press Enter > type VSIXInstaller.exe > press Enter > check if the extension has been installed.

What is VSIX in Visual Studio code?

A VSIX package is a . vsix file that contains one or more Visual Studio extensions, together with the metadata Visual Studio uses to classify and install the extensions. That metadata is contained in the VSIX manifest and the [Content_Types]. xml file.


1 Answers

Try adding the following attribute to your VSPackage class:

[ProvideAutoLoad(Microsoft.VisualStudio.Shell.Interop.UIContextGuids80.SolutionExists)]

That will trigger your package to load when a solution is opened/created.

like image 97
Aaron Marten Avatar answered Sep 18 '22 03:09

Aaron Marten