---
# System prepended metadata

title: '`VSIX`で、`AsyncPackage` を自動的に読み込む方法 2022-01-26'
tags: [VSIX, PackageAutoLoadFlags.BackgroundLoad, AsyncPackage, VSConstants.UICONTEXT.SolutionOpening_string]

---

---
lang: ja-jp
breaks: true
---
# `VSIX`で、`AsyncPackage` を自動的に読み込む方法 2022-01-26

## クラスに `[ProvideAutoLoad(VSConstants.UICONTEXT.SolutionOpening_string, PackageAutoLoadFlags.BackgroundLoad)]`属性を付与する。

```csharp=
    [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
    [Guid(VSIX_ActionsToComplementUsingPackage.PackageGuidString)]
    [ProvideAutoLoad(VSConstants.UICONTEXT.SolutionOpening_string, PackageAutoLoadFlags.BackgroundLoad)]
    [ProvideMenuResource("Menus.ctmenu", 1)]
    public sealed class XXXXPackage : AsyncPackage
    {
・・・
```

## 動作確認済み環境

* Visual Studio 2022

###### tags: `VSIX` `AsyncPackage` `PackageAutoLoadFlags.BackgroundLoad` `VSConstants.UICONTEXT.SolutionOpening_string`
