Steps to reproduce:
- Open Visual Studio 2017. Select File.. New.. Project..
- From the New Project dialog, select Extensibility.. VSIX Project..
- Select the new Project from the Solution Explorer. Right Click and Add.. New Item.. Extensibility.. Custom Command..
- You now have a complete custom command built from the standard templates. Run it in the debugger. You'll get a experimental instance of Visual Studio. From the menus, select Tools... Invoke Command1... Your custom command works!
- Hit 'OK' and exit the experimental instance of Visual Studio.
- Now, back in the original solution, click Tools.. NuGet Package Manager.. Manage NuGet Packages for Solution...
- In the Updates tab, you'll see there are many updates to the standard packages included in the template. Select them all and update them. Repeat until all your packages have been updated. You will likely need to restart VS during the process.
Build your VSIX package again. You may have to supress the warning around this statement:
public static async Task InitializeAsync(AsyncPackage package) { // Verify the current thread is the UI thread - the call to AddCommand in Command1's constructor requires // the UI thread. #pragma warning disable VSTHRD109 // Switch instead of assert in async methods ThreadHelper.ThrowIfNotOnUIThread(); #pragma warning restore VSTHRD109 // Switch instead of assert in async methods OleMenuCommandService commandService = await package.GetServiceAsync((typeof(IMenuCommandService))) as OleMenuCommandService; Instance = new Command1(package, commandService); }
Debug your VSIX package again.
- Select Tools... Invoke Command 1...
- You get an error: The 'Command1Package' package did not load correctly.
If you follow the instructions to the %AppData% directory and read the activity log, you'll see that the Microsoft.VisualStudio.Threading 15.8.0.0 assembly can't be loaded.
Could not load file or assembly 'Microsoft.VisualStudio.Threading, Version=15.8.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Threading, Version=15.8.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.