- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
以下场景。我在 VS 2017 中创建了一个新的 VSIX 项目。我在那里插入了一个新的工具窗口。此外,我还创建了一个类库。生成的结构如下:
我唯一改变的是
我向 ToolWindow1Package
类添加了两个属性,以便在我加载解决方案时立即加载它
[ProvideAutoLoad(VSConstants.UICONTEXT.SolutionHasSingleProject_string)]
[ProvideAutoLoad(VSConstants.UICONTEXT.SolutionHasMultipleProjects_string)]
Initialize
方法
protected override void Initialize()
{
ToolWindow1Command.Initialize(this);
base.Initialize();
Class1 class1 = new Class1();
Console.WriteLine(class1);
}
当我加载解决方案时,程序包无法加载,事件日志中有以下条目
<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>
库的dll仍然在扩展dll的文件夹中:
我什至尝试将库作为 Assets 添加到 .vsixmanifest 中,但情况没有发生变化。有谁知道这个问题和解决方法?
最佳答案
如错误消息所述,您必须通过向项目添加 key.snk 文件对 TestLibrary dll/项目进行强签名。 (项目属性,签名)
关于c# - VsPackage中类库的使用方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48191001/
我们正在团队中使用 Visual Studio 2012 和 TFS 开发 VSPackage。 该扩展在用于创建它的计算机上运行良好(通过向导)。在另一台计算机上,当我们尝试运行它时(使用 F5),
我希望在解决方案完全加载后收到通知。受此启发answer我尝试实现 IVsSolutionEvents。 当我加载包含两个 C# 项目的解决方案时,等到加载完成并最终关闭 Visual Studio
我正在通过 VSPackage 为 Visual Studio 开发语言服务。每当从解决方案的项目中添加/删除文件时,我都需要更新我的解析数据。 我想订阅解决方案和项目事件。 我尝试如下,但是当我向解
这个问题在这里已经有了答案: Detect current VSIX package's version from code (3 个答案) 关闭 7 年前。 我想检查当前安装的 VSPackage
我有一个 VSPackage for Visual Studio 2008,我创建它是为了添加一些编辑器和自定义语言功能。我还需要添加一个新的项目/解决方案向导来创建一个新的解决方案和一系列复杂的 C
我是扩展 Visual Studio 的新手,我正在尝试寻找方法来查找当前解决方案使用的源代码控制系统。 我创建了 VsPackage 项目,我能够通过 IVsSolution 获取对解决方案的引用,
我已经创建了一个包,我想向 代码窗口 上下文菜单添加一个菜单。 经过一番搜索,我找到了几篇解释如何操作的文章。问题是,我无法让它工作.... 这是我在 vsct 文件中的声明:
以下是如何从加载项获取当前解决方案目录: _applicationObject = (DTE2)application; // retrieved from OnConnection method
我一直在开发一个 Visual Studio 扩展作为 VS2008/2010 的插件。现在的新版本将仅作为 VS2010 的 VSIX 包完成(因为无论如何它必须是 .NET 4),并且我在处理 U
我已经创建了简单的 VS 包,用于在解决方案资源管理器的上下文菜单中添加新项目。因为我需要检查选定项目的项目类型 GUID。我怎样才能得到这个。 例如,One Solution 包含三种不同类型的项目
我创建了 VSPackage,它在 Visual Studio 代码窗口上下文菜单中提供某些功能。此操作包括几个代码编辑和一些周围的东西。 问题是,这些代码编辑中的每一个都被单独添加到撤消堆栈中。我想
我正在开发一个扩展 (VSPackage),我正在订阅 VSPackage.cs 构造函数中的 2 个调试器事件 public sealed class ComboBoxPackage : Packa
每当事件 TextView 中的插入符号位置发生变化时,我都希望得到通知。 EnvDTE 似乎唯一提供的是 the LineChanged event ,当然在同一行内向左或向右移动插入符号时不会引发
我正在尝试创建一个使用 Roslyn 语言服务的 VsPackage。在我的 VsPackage 的属性下,我将命令行参数更改为: /rootsuffix Roslyn 运行项目时,启动的 Visua
用于扩展 Visual Studio 的文档几乎不存在,在撞墙之前,我设法从互联网上的十几个或更多晦涩的源代码中拼凑出几行功能代码。 我需要做的就是订阅一个在插入片段后触发的事件。听起来很容易,至少我
我正在创建一个包含单个文件生成器 (IVsSingleFileGenerator) 的 Visual Studio VSPackage,我希望能够将事件记录到 Visual Studio 错误列表 (
假设我们有一个带有工具栏的 VSPackage 以及工具栏上的几个命令。 如何以编程方式显示/隐藏工具栏上的命令之一?如果您是用户,则可以通过自定义工具栏来实现。因此,我有一种强烈的感觉,一定有一种方
我的包只在实验实例中加载。我有以下包类属性: [PackageRegistration(UseManagedResourcesOnly = true)] [InstalledProductRegist
如何检查/检测在我的 VSPackage 下运行的 Visual Studio 版本? 我无法从注册表中获取,因为计算机可能安装了多个版本,所以我猜有一个 API 可以获取它。 有人知道如何使用 C#
我需要能够与我的包类中的 MEF 组件进行通信。我尝试了几种不同的方法: 使用了包类中的 [import] 属性。但是,属性始终为空。我发现这是因为您无法从包类中导入 MEF 组件。 尝试调用“com
我是一名优秀的程序员,十分优秀!