Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
374 views
in Technique[技术] by (71.8m points)

c# - 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.

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.

Someone knows how to really debug it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I've built a few Visual Studio extension and I've never found a good way to debug a 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. Load up the solution.
  • Make some changes, build.
  • Install the .vsix (double clicking the vsix file in indebug)
  • Launch a new Instance of Visual Studio for testing.
  • In the Dev Visual Studio, Debug -> Attach to Process and select devenv.exe
  • In the Dev Visual Studio, set some break points.
  • In the Test Visual Studio, create / open new solution and start test coding.

I've found this to be much faster than launching the VS Experimental Instance. 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. 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...