Domanda

I use Visual Studio 2010, C#, .Net 4.0.

I want to create a VS2010 Template for a project. The output is in a .dll file.

I already have a program ABC.exe . This program can get a path to a .dll as an input parameter.

Here is my need: I need to customize the behavior of the Debug process in my VS2010 Template the following way. First of all, the Debug option should be available (even though the output is a .dll). Secondly, when I press "Start Debugging", the following actions should take place:

  1. the output .dll should be built

  2. the program ABC.exe should be started with the input string containing the path to the output .dll

  3. VS attaches itself as a debugger to ABC.exe

Is it possible to customize a VS2010 Template this way?

Here are the steps that I can do separately from the task that I'm interested in:

  • No problem to run the program ABC.exe - it's pretty easy. For example, Process.Start(startInfo).
  • it seems that I can programmatically attach the debugger to a process (I've done similar things before with Debugger Interface but I'm not sure how suitable that code would be for the task described in the question)
  • I can create a VS2010 Template - that's pretty straightforward (exactly as it is written in the MSDN manual)
  • In general, I can run something from the outside of the VS2010 to build the .dll based on the files in the project (but I'm really not sure whether I would ever need to do this)

What I really have no clue about is the following:

  1. how to make the Debug button available in VS2010 for my template
  2. how to assign some additional actions to the Debug button. I can only guess that maybe some Visual Studio macros might help. But frankly have no idea where to start from.

Any help is very much appreciated!

È stato utile?

Soluzione

Go to the project properties into the Debug tab, you should set it up something like this:

Debug tab

This will even allow breakpoints in Visual Studio to be hit from your dll, and be debugged as normal.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top