无法调试 VSIX 项目

发布于 2024-12-09 17:34:16 字数 465 浏览 0 评论 0 原文

我正在尝试开发我的第一个 Visual Studio 扩展项目,我安装了 VS10 SDK 并且能够创建一个新项目并且可以很好地构建它,但是当我尝试调试符号时未加载。我知道我可以调试到 VSIX 项目,因为我已经在线下载了一个示例项目,并且加载了它的符号并且很好地命中了断点 http://weshackett.com/2009/11/configure-vsix-project-to-enable-debugging/)。 所以一定是与我创建 VSIX 项目的方式有特殊关系(也许!)。 我注意到的一件事是,dll 和文件没有被复制到本地“应用程序数据”区域,只有清单被复制,而对于示例项目,所有文件都被复制,包括 dll。我比较了两者之间的项目设置,它们都是相同的。 我希望这是有道理的,如果我可以提供更多细节,请告诉我......

I'm trying to develop my first visual studio extensions project, I have VS10 SDK installed and was able to create a new project and can build it fine, however when I attempt to debug symbols are not loaded. I know that I can debug to VSIX project since I have downloaded a sample project online and it symbols are loaded and break points are being hit fine http://weshackett.com/2009/11/configure-vsix-project-to-enable-debugging/).
So must be something specifically to do with the way I have created the VSIX project ( maybe !).
One thing I do notice is that the dll and files aren't being copied over to the local "Application Data" area, only the manifest is being copied over, while for the sample project, all files are being copied over including the dll. I have compared project settings between both and they are both the same.
I hope it makes sense, if I can provide any more detail then let me know...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

荒人说梦 2024-12-16 17:34:16

好的,我设法让它工作。为此,我必须卸载 vsix 项目并将该文件编辑为 XML 文档。

从项目文件中删除以下行:

<IncludeAssemblyInVSIXContainer>
    false
</IncludeAssemblyInVSIXContainer>
<IncludeDebugSymbolsInVSIXContainer>
    false
</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>
    false
</IncludeDebugSymbolsInLocalVSIXDeployment>
<CopyBuildOutputToOutputDirectory>
    false
</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>
    false
</CopyOutputSymbolsToOutputDirectory>

或将它们设置为 true:

<IncludeAssemblyInVSIXContainer>
    true
</IncludeAssemblyInVSIXContainer>
<IncludeDebugSymbolsInVSIXContainer>
    true
</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>
    true
</IncludeDebugSymbolsInLocalVSIXDeployment>
<CopyBuildOutputToOutputDirectory>
    true
</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>
    true
</CopyOutputSymbolsToOutputDirectory>

或将它们添加到 ... 节点下(如果它们不存在)。

删除这些行并重建解决方案后,dll 和 pdb 现在按预期复制到 bin\debug 文件夹以及“AppData\Local\Microsoft\VisualStudio\10.0Exp\Extensions\”文件夹。

OK I managed to get it working. In order to do so, I had to unload the vsix project and edit the file as an XML document.

Either remove the following lines from the project file:

<IncludeAssemblyInVSIXContainer>
    false
</IncludeAssemblyInVSIXContainer>
<IncludeDebugSymbolsInVSIXContainer>
    false
</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>
    false
</IncludeDebugSymbolsInLocalVSIXDeployment>
<CopyBuildOutputToOutputDirectory>
    false
</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>
    false
</CopyOutputSymbolsToOutputDirectory>

or set them to true:

<IncludeAssemblyInVSIXContainer>
    true
</IncludeAssemblyInVSIXContainer>
<IncludeDebugSymbolsInVSIXContainer>
    true
</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>
    true
</IncludeDebugSymbolsInLocalVSIXDeployment>
<CopyBuildOutputToOutputDirectory>
    true
</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>
    true
</CopyOutputSymbolsToOutputDirectory>

or add them under the ... node if they don't exist.

Once I removed these lines and rebuilt the solution, the dll and pdb were copied now as expected to the bin\debug folder as well as to the "AppData\Local\Microsoft\VisualStudio\10.0Exp\Extensions\" folder.

硪扪都還晓 2024-12-16 17:34:16

在 VS-2019 中,我正在开发一个 VSIX 异步,它工作得很好,但是在某个时刻,Visual Studio 实验版本停止在调试模式下加载我的 VSIX。

我不确定根本原因,但它与在 Visual Studio 的同一解决方案中打开第二个 VSIX 项目模板同时发生。不知道这是否与该问题有关,但在第一次运行时,我发现两个 VSIX-es 都加载到实验版本会话中。那时,我关闭并重置了实验版本。在接下来的运行中,调试时似乎没有 VSIX 加载到实验版本中..非常令人沮丧!

我找到的解决方案是

  • 使用“开始”菜单中的命令行工具关闭 Visual Studio 的任何实例
  • 重置 Visual Studio 实验版本
  • 打开 VS,加载您的 VSIX 解决方案
  • 清理您的 VSIX 解决方案
  • 切换到发布模式(是的,执行此操作.. )
  • 重建解决方案,然后
  • 在“仅我的代码”警告弹出窗口中运行,选择“继续调试”,
  • 实验版本现在将随您的 VSIX 一起启动!已加载!
  • 发布模式在调试时不太方便。 关闭 Exp 版本您将返回 VSIX 解决方案
  • 切换回调试模式
  • 再次运行

对我来说,上面的顺序可以让问题消失。 VSIX 已按预期加载。

Been there.. in VS-2019 I'm developing a VSIX Async which worked fine, however at a certain point, Visual Studio Experimental Version stopped loading my VSIX in debug mode.

I am not sure of the root cause, but it coincided with opening a second VSIX project template in the same solution of Visual Studio. Don't know if that has anything to do with the issue, but on the first run, I found both VSIX-es loaded into the Experimental version session. At that point, I closed and reset the Experimental Version. On the next runs, no VSIX seemed to be loaded into the Experimental Version, when debugging.. very frustrating !

The solution I found, fiddling around

  • close any instances of Visual Studio
  • reset the Visual Studio Experimental Version using the commandline tool in Start menu.
  • Open VS, load your VSIX solution
  • clean your VSIX solution
  • switch to Release mode (yes, do it..)
  • Rebuild Solution then run
  • on the Just my Code warning popup, choose Continue Debugging
  • The Experimental Version will now start with your VSIX ! it is loaded !
  • Release mode is not handy when debugging. Close the Exp version You will be back in your VSIX solution
  • Switch back to Debug mode
  • run again

For me, above sequence lets the problem disappear. VSIX is loaded as it should.

你丑哭了我 2024-12-16 17:34:16

我在 Visual Studio 2017 中遇到了类似的情况。
@Rubans 描述的选项似乎没有必要(不再?)。

在当前的构建配置(最有可能调试)中,您需要确保在 Vsix 属性页中选中将 VSIX 内容部署到实验实例以进行调试

输入图像描述这里

I ran into something simular in Visual Studio 2017.
The options described by @Rubans don't seem to be necessary (anymore?).

In your current build configuration (Most likely Debug), you need to make sure, that Deploy VSIX content to experimental instance for debugging is checked in the Vsix property page:

enter image description here

遗忘曾经 2024-12-16 17:34:16

我有同样的问题 - 调试会开始,但无论我在哪里设置断点,我都会看到它“无用”,并且带有“断点不会被命中”注释。我在这里检查了其他答案中的所有内容,然后在一个插件项目存储库中找到了“贡献者指南”(特定版本的永久链接)。

因此,对我有帮助的是:打开项目属性,然后在“调试”选项卡上确保:

  1. “启动操作”设置为“启动外部程序”,并且路径与 devenv 的路径匹配。 exe - 例如“C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe” - 这就是默认情况下的内容。

  2. “启动选项”的“命令行参数”设置为/rootsuffix Exp - 默认情况下缺少它,我必须添加它

因此,一旦我添加了 /rootsuffix Exp ,它就会开始工作 - 下次我按 F5 时,插件代码中的断点就会工作。

I had the same looking issue - debugging would start but wherever I would set a breakpoint I'd see it "useless" and with "breakpoint will not be hit" annotation. I checked all the stuff in the other answers here and then I found a "contributor guide" in one plugin project repository (permalink to specific version).

So what helped me was the following: open the project properties, and on the "Debug" tab ensure that:

  1. "Start action" is set to "Start external program" and the path matches the path to devenv.exe - such as "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe" - that's what it was by default.

  2. "Start options" had "command line arguments" set to /rootsuffix Exp - that was missing by default and I had to add it.

So once I added /rootsuffix Exp it would start working - next time I pressed F5 the breakpoints in the plugin code would work.

宫墨修音 2024-12-16 17:34:16

我也有同样的问题,在 Visual Studio 2019 中,调试命令运行参数是 /rootsuffix Roslyn

我尝试更新项目并重建;但它不起作用。
幸运的是,我找到了另一种调试方法。
这就是unitTest
在vsix模板创建的最新解决方案中;它包含 uniteTests 项目。

在测试方法中,您可以调用VerifyCSharpc方法来测试Diagnostic,并调用VerifyCSharpFix方法来测试Fix;当你调试unitTest时,你可以命中正确的断点

I have the same problem,And in visual studio 2019,the debug command run arguments is /rootsuffix Roslyn

I try to update project and rebuild;but it not work.
Luckly, I find another way to debug it.
That is unitTest.
In the newest solution which created by the vsix template; It contains the uniteTests project.

In the testmethod,you can invoke VerifyCSharpc method to test Diagnostic,and invoke VerifyCSharpFix method to test Fix; when you debug the unitTest ,you can hit the right breakpoint

極樂鬼 2024-12-16 17:34:16

偶然发现如何在 vs 2017 15.9.20 中修复它

:在新 VS 中卸载扩展,按 F5 重新运行新 VS,然后清理并重建解决方案,然后再次按 F5 运行。

当您在卸载扩展后重新运行 VS 时,新的 VS 会“理解”您的扩展已被删除。之后,您重建代码并将其“放入”新的 VS 中。

详细信息:

  • 运行 F5,在新的 VS 中转到“扩展”并卸载您的扩展,
  • 在打开的“卸载 VSIX”窗口中关闭新的 VS
  • - 卸载您的扩展
  • 不要更改任何内容,只需按 F5 重新运行代码,检查扩展是否已在新启动的 VS 中删除,关闭
  • 编码中的新VS -
  • 干净的解决方案重建,享受
  • F5运行

Accidentally found how to fix it in vs 2017 15.9.20

Shortly: uninstall your extension in new VS, re-run new VS by F5, then clean and rebuild solution, then run by F5 again.

When you re-run VS after uninstalling your extension, new VS "understands" that your extension was removed. After that you rebuild code and "put" it in new VS.

Detaily:

  • run F5, in new VS go to Extensions and uninstall your extension
  • close new VS
  • in opened Uninstall VSIX window - uninstall your extension
  • do not change anything, just re-run the code by F5, check that extension is removed in new started VS, close new VS
  • in your coding VS - clean Solution
  • rebuild
  • run by F5, enjoy
醉态萌生 2024-12-16 17:34:16

您可以尝试重置 Visual Studio Experimental(它对我有用)。
转到开始菜单 -> Visual Studio 2019 ->重置Visual Studio 2019实验实例

(每个Visual Studio版本都有其链接)

You can try reset Visual Studio Experimental (it works for me).
Go to Start Menu -> Visual Studio 2019 -> Reset the Visual Studio 2019 Experimental Instance

(each visual studio version has its link)

对你而言 2024-12-16 17:34:16

我必须执行以下操作:

  1. 确保您的符号设置配置正确
    输入图片此处描述
  2. 我不得不更改扩展版本。只需将其设置为比本地安装的数字更高的数字即可:
    输入图片此处描述

I had to do the following:

  1. Make sure that your Symbols Settings are properly configured
    enter image description here
  2. I had to bump the extension version. Just make it a higher number than what you have installed locally:
    enter image description here
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文