This question deals with my question, just not with changes made in Visual Studio 2019
, where VSIX
projects load asynchronously, where in previous versions of Visual Studio VSIX projects loaded synchronously.
I am using IVsSolutionEvents3
in my VSIX projects to get notified of
VSTestPackage1: OnAfterOpenProject
VSTestPackage1: OnQueryCloseSolution
VSTestPackage1: OnQueryCloseProject
VSTestPackage1: OnQueryCloseProject
VSTestPackage1: OnBeforeCloseSolution
VSTestPackage1: OnQueryCloseProject
VSTestPackage1: OnBeforeCloseProject
VSTestPackage1: OnQueryCloseProject
VSTestPackage1: OnBeforeCloseProject
VSTestPackage1: OnAfterCloseSolution
I modified the decoration to my VSIX project to incorporate the recommended SolutionExistsAndFullyLoaded
, however the I do not get any notifications for the very first solution that a user opens. In VS2019 that is from there new dialog that shows prior to the actual IDE.
[ProvideAutoLoad(VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_string, PackageAutoLoadFlags.BackgroundLoad)]
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
[Guid(VSTestPackage1.PackageGuidString)]
[InstalledProductRegistration("#110", "#112", "2017.1.4.664", IconResourceID = 400)]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")]
[ProvideMenuResource("Menus.ctmenu", 1)]
public sealed class VSTestPackage1 :
AsyncPackage,
IVsSolutionEvents3,
IVsUpdateSolutionEvents,
IVsBuildStatusCallback,
IDisposable
{
}
I receive notifications for all solutions after the initial solution loads and for the closing of the initial solution, just not the loading of the initial solution. What I see from debugging is that after the initial solution loads, my VSIX projects initializes.
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
{
System.Diagnostics.Debug.WriteLine("VSTestPackage1: Entering Initialize()");
...
}
The InitializeAsync()
call does not provide a IVsHierarchy pHierarchy
, which would allow me to extract the already open solution/project.
How can I get notified of the initial solution/project?