简体   繁体   English

如何调试Vsix项目

[英]How to debug a Vsix project

I'm creating a custom test runner for my project. 我正在为我的项目创建一个自定义测试运行器。 So I've created a test vsix project which can be registered in Visual Studio. 所以我创建了一个可以在Visual Studio中注册的测试vsix项目。

I also knows that I load the extension through F5, then the experimental instance of Visual Studio is loaded, but breakpoints are not hit in the Visual Studio Instance in which I've created my vsix. 我也知道我通过F5加载扩展,然后加载了Visual Studio的实验实例,但是在我创建了我的vsix的Visual Studio实例中没有命中断点。

Someone knows how to really debug it? 有人知道如何真正调试它吗?

I've built a few Visual Studio extension and I've never found a good way to debug a VSIX. 我已经构建了一些Visual Studio扩展,我从来没有找到一种调试VSIX的好方法。 You can launch an experimental instance, but I've found this to be the slowest possibility. 你可以启动一个实验实例,但我发现这是最慢的可能性。

This is the workflow I use: 这是我使用的工作流程:

  • Open a Visual Studio instance for development. 打开Visual Studio实例进行开发。 Load up the solution. 加载解决方案。
  • Make some changes, build. 做一些改变,建立。
  • Install the .vsix (double clicking the vsix file in \\bin\\debug) 安装.vsix(双击\\ bin \\ debug中的vsix文件)
  • Launch a new Instance of Visual Studio for testing. 启动一个新的Visual Studio实例进行测试。
  • In the Dev Visual Studio, Debug -> Attach to Process and select devenv.exe 在Dev Visual Studio中,调试 - >附加到进程并选择devenv.exe
  • In the Dev Visual Studio, set some break points. 在Dev Visual Studio中,设置一些断点。
  • In the Test Visual Studio, create / open new solution and start test coding. 在Test Visual Studio中,创建/打开新解决方案并开始测试编码。

I've found this to be much faster than launching the VS Experimental Instance. 我发现这比启动VS实验实例要快得多。 But it's still quite arduous. 但它仍然非常艰巨。

The other thing I highly recommend, is to abstract as much of the Visual Studio API as you can do unit testing and doing only the bare minimum of testing in Visual Studio. 我强烈推荐的另一件事是抽象尽可能多的Visual Studio API,因为你可以进行单元测试,并且只在Visual Studio中进行最低限度的测试。 For example, in a project I'm working on now, pMixins , I've abstracted out the Visual Studio event system ( VisualStudioEventProxy ) so that my infrastructure doesn't have a hard dependency on the event api, and I can write a test which simulates events. 例如,在我正在研究的项目中, pMixins ,我已经抽象出了Visual Studio事件系统( VisualStudioEventProxy ),这样我的基础设施就没有对事件api的硬依赖,我可以写一个测试它模拟事件。

A bit late, but may be helpful for others. 有点晚,但可能对其他人有帮助。

A suggestion I found here helped me to resolve my problem with debugging my .vsix component in VS2012. 我在这里找到的建议帮助我解决了在VS2012中调试我的.vsix组件的问题。 In short: add to project properties "start external program:" [your visual studio path], add to "Command line arguments" /rootsuffix Exp . 简而言之:添加到项目属性“启动外部程序:”[您的可视工作室路径],添加到“命令行参数” /rootsuffix Exp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM