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. 回答1: 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. 回答2: Author asked about VS2010, so it should be: [ProvideAutoLoad(VSConstants