VSIX: execute code on VS startup
Asked Answered
M

2

9

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.

Mccafferty answered 19/10, 2011 at 0:59 Comment(0)
V
18

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.

Vardon answered 19/10, 2011 at 4:2 Comment(0)
P
4

Author asked about VS2010, so it should be:

[ProvideAutoLoad(VSConstants.UICONTEXT.SolutionExists_string)]

VSConstants sit in:

\Microsoft Visual Studio 2010 SDK SP1\VisualStudioIntegration \Common\Assemblies\v4.0\Microsoft.VisualStudio.Shell.10.0.dll

Portentous answered 10/4, 2012 at 12:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.