views:

38

answers:

1

Background

I have a macro AttachToRemoteProcess that I use to attach the debugger to a running process on a remote computer. The macro use hard coded names for the process and the computer. I use the macro from a toolbar button on a custom toolbar. I consider this a sub par solution and I don't really like to have such a macro in my Visual Studio environment since it only works for the specific program/environment it was hard coded for.

I am using Visual Studio 2008.

Solutions

I can imagine two solutions but I do not know if they are possible to implement.

Alternative 1

I would like to either have the macro AttachToRemoteProcess being part of the solution (.sln) or one of the projects (.csproj) and have the toolbar appear when the solution or project has been loaded into Visual Studio. In this case it is OK to have hard coded settings such as process and computer name.

Alternative 2

  • The macro AttachToRemoteProcess is made reusable by taking process and computer as parameters.
  • The custom toolbar, button and the macro are always available in Visual Studio. This is just like my current solution, except for the parameterized macro.
  • When the button is clicked the computer name and process name is looked up from somewhere in the solution or the current project.

Questions

  1. Would any of the alternative work and how can I go about doing it?
  2. Are there any other alternative solutions for what I want to achieve?
+1  A: 

The second alternative seems to work. Instead of retrieving the parameters from the solution (perhaps using VBA and the class EnvDTE.DTE.Solution), you could display a small form to select the process and computer and use this input as parameters to your macro. The button would be displayed in a personal toolbar all the time.

I'm not sure whether you can "attach" macros to particular solutions. If that's not possible, you will have no way to implement alternative 1.

MP24