将 WPF 自定义控件库引用到 VSIX 项目

Reference WPF custom control library to a VSIX project

我的解决方案中有一个 WPF 自定义控件项目和一个 VSIX 项目。 WPF 包含 UI windows 和 VSIX 以及另一个可以与 VS 扩展分开使用的 WPF 应用程序所需的控件。

我已将项目添加为 source.extension.vsixmanifest 中的依赖项 像这样:

<Asset Type="Microsoft.VisualStudio.Assembly" d:Source="Project" d:ProjectName="StringsRefactor.UI" Path="|StringsRefactor.UI|" AssemblyName="|StringsRefactor.UI;AssemblyName|" />

代码可以编译,但是在运行时,当我从 StringsRefactor.UI 程序集构造所需的对象时,出现以下错误:

Could not load file or assembly 'StringsRefactor.UI, Version=1.0.0.0, Culture=neutral, PublikKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

我应该如何创建 strongly-named assembly? 或者我应该做点别的吗?

只需签署您的 WPF 程序集,它是 Visual Studio

所要求的