Following scenario. I have created in VS 2017 a new VSIX Project. There I have inserted a new Tool Window. Additionally I have created a class library. The resulting structure is as follows:
The only thing I have change are
that I added two attributes to the ToolWindow1Package
class so that it is loaded as soon as I load a solution
[ProvideAutoLoad(VSConstants.UICONTEXT.SolutionHasSingleProject_string)]
[ProvideAutoLoad(VSConstants.UICONTEXT.SolutionHasMultipleProjects_string)]
the Initialize
method
protected override void Initialize()
{
ToolWindow1Command.Initialize(this);
base.Initialize();
Class1 class1 = new Class1();
Console.WriteLine(class1);
}
When I load a solution the package cannot load with the following Entry in the ActivityLog
<entry>
<record>1396</record>
<time>2018/01/10 15:16:12.081</time>
<type>Error</type>
<source>VisualStudio</source>
<description>LegacySitePackage failed for package [ToolWindow1Package]Source: 'TestExtension' Description: Could not load file or assembly 'TestLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
System.IO.FileLoadException: Could not load file or assembly 'TestLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
File name: 'TestLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
 at TestExtension.ToolWindow1Package.Initialize()
 at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(IServiceProvider sp)

</description>
<guid>{673860A0-BAF8-46CB-BDFD-F758C4C6EE3C}</guid>
<hr>80131044</hr>
<errorinfo></errorinfo>
The dll of the library is nonetheless in the folder of the extension dll:
I even tried to add the library as an asset in the .vsixmanifest without a change in the situation. Does anyone know this problem and a workaround?
You must strong sign the TestLibrary dll/project, as the error message says, by adding a key.snk file to the project. (Project properties, Signing)
User contributions licensed under CC BY-SA 3.0