Is there any way to define several view configuration in visual studio 2008? - visual-studio

Is there any way to define an IDE Layout in visual studio 2008?
Lets say that when I code in C# , I have the properties windows disabled and the output window at the bottom. Now Lets say that when I am in the visual editor of a window , I want the tools and the properties windows on the left and the output window disabled.
the problem is that If i want to work that way I have to manually rearrange the IDE layout each time I switch from code edit to visual edit.
I would like to have an option to define several IDE layout and for each assign a hotkey.
So I can quickly change between the layouts.
Is there a feature like this in visual studio 2008?

Visual Studio has a notion of layouts but they are applied automatically depending on the current mode (design, debug, etc). You could create IDE macros to show / hide your tool windows though:
Enable properties:
Sub PropertiesOn()
DTE.ExecuteCommand ("View.PropertiesWindow")
End Sub
Disable properties:
Sub PropertiesOff()
DTE.Windows.Item(Constants.vsWindowKindProperties).Close
End Sub
You can use the macro recorder (Ctrl+Shift+R) to see what commands are needed to display or hide the other tool windows. Build up your macros (using the Macros IDE - Alt+F11 or Tools | Macros | Macros IDE) to enable / disable groups of tool windows. Then you can bind the macros to your own keybinding or simply invoke them from the commands window. Alternatively, you can execute macros using the Macros Explorer (Alt+F8 or Tools | Macros | Macro Explorer).

Related

Visual Studio shortcut for opening command prompt in current project path

On a keyboard shortcut, I want to be able to start the Windows command prompt with the working directory set to the current project directory selected in solution explorer (or text editor). Unfortunately, I am unable to find an appropriate keyboard shortcut in the Visual Studio settings.
Is such a thing possible inside Visual Studio and Visual Studio Code? And if so, how can I set it up?
Sure this is possible!
Configure an external tool
You have to set up a custom external tool. For that, go to Tools > External Tools... and click Add and configure the tool like this:
Setup the keyboard shortcut
Next, you want to bind a shortcut to that external tool. For that go to Tools > Options > Environment > Keyboard and bind your desired shortcut to Tools.ExternalCommand1. Make sure you have moved the external tool to the first position in the window shown above.
Additional Information (For Visual Studio Code)
To Open New Command Prompt use Ctrl+Shift+C to perform same action
named workbench.action.terminal.openNativeConsole

Shortcut button for remote debugging in Visual Studio

I want to add a shortcut-button in Visual Studio 2015. Clicking this button should just emulate "Attach To Process" -> Select "w3wp.exe" -> Attach.
Does anyone know how to do it?
You can't do those two commands on one toolbar button click apart from creating or using an existing Visual Studio extension.
Creating a Visual Studio extension would be feasible but somewhat involved (as a complete project in itself).
Available Extensions:
The first extension you could use is Visual Commander (detailed below) to create a Macro.
Depending on your needs you could also use AttachTo which provide a one click option to attach to IIS.
Finally there is also Debug Attach Manager which can attach to specific process and then remember it.
Using a macro to achieve the desired effect:
As mentioned by #Sergey Vlasov, you can can install a Visual Studio Extension named Visual Commander that brings back Macros in Visual Studio. Then you can program a macro to do this for you. The code for the macro comes from another SO answer
Public Sub AttachShortcut()
For Each proc In DTE.Debugger.LocalProcesses
If proc.Name = "what you're looking for" Then
proc.Attach()
Exit Sub
End IF
Next
End Sub
Adding the shortcut button:
You can also easily add a button in your toolbar to add "Attach to Process..." if you prefer to have the button on your toolbar.
To do this go in the Menu under TOOLS. Then choose Customize.
There select the second tab "Commands".
The select Toolbar and choose the toolbar you want the button to appear in. For example "Debug" if you want it to appear during debugging.
Then press the Add Command... button and choose the Debug category. There you will find the Attach to Process.
This would make it more readily available if you prefer to use the toolbar.

How to switch view modes in built-in Diff viewer of Visual Studio 2012 and 2013?

Currently, this is how Visual Studio displays the differences between files:
I would like it to display the two files separately (including the red/green notations), as I believe is the default settings. How do I change the way it displays the differences?
Check the 'Compare Files' toolbox, there is a button for it.
Or use the keyboard shortcut Ctrl+\, Ctrl+2.

Adding a Visual Studio toolbar button for a command that is only available as a keyboard shortcut

This question relates to this ReSharper YouTrack issue.
In Visual Studio 2010 with ReSharper 7.1.1 installed, if I go to Tools > Options > Environment > Keyboard, there is a command called ReSharper_SilentCleanupCode.
I would like to bind this command to a toolbar button.
This seems to be impossible using Tools > Customize > Commands because the only commands available within this dialog are for actions that already have an associated menu item. The particular ReSharper command I'm interested in (Silent Code Cleanup) doesn't appear in any menu, so it cannot be assigned to a toolbar button using the "GUI".
Is there any other way to bind a keyboard-only command to a toolbar button? (One of ReSharper's programmers thought the "VS script editor" could be used, but I'm not having any luck finding info on this.)
Edit
I should have mentioned this in the first place. While azhrei's macro solution is great for Visual Studio 2010, it will break once I upgrade to VS 2012, because macros are no longer supported. If someone has a solution that will continue to work in VS 2012, that would be preferable. (Or perhaps VS 2012 toolbars don't have the same limitation in the first place?)
Add a macro that executes the command, then add the macro to a toolbar.
This works because it makes the keyboard-only command appear in the Macros menu in the Customize Commands dialog.
Details
Add a macro which does this:
Sub _ReSharper_SilentCleanupCode()
DTE.ExecuteCommand("ReSharper_SilentCleanupCode")
End Sub
Put this macro in a module which appears in Customize..Commands..AddCommand..Categories..Macros, such as Samples or MyMacros.RecordingModule, but not MyMacros.Module1 (the default when using the macro IDE).
Go to Tools..Customize..Command and select the Toolbar you want.
Now Add Command... and select the Macros category.
Select your Macros.Samples._ReSharper_SilentCleanupCode macro.
Click Modify Selection and change the name to #-) or whatever text makes you think ReSharper Silent Code Cleanup without being too long for your toolbar. :-)
I tried this with Visual Studio 2010 and ReSharper 7.1.2.
Edit
Visual Commander is a apparently way to get this going on VS2012 as well - see comments below for more.

How does one set Visual Studio 2010 keyboard shortcuts comfortably, especially when using ReSharper?

In every Visual Studio.NET version you can set keyboard shortcuts using menu Tools -> Options -> Environment -> Keyboard and then find the command you want to assign a shortcut to by entering part of it in "Show commands containing".
For one thing, the listbox is ridiculously short and hard to navigate - is there an alternative?
Then, how do I find out the correct command name for a specific action?
Specifically, I'm using ReSharper 5.1 with Visual Studio 2010 and want to have the Alt + Enter shortcut back (it used to be there in older versions by default) that opens the ReSharper context menu when the cursor is over a curly underline ReSharper uses to highlight errors or warnings.
How do I find out the command name for that (except by an educated guess)?
The way I do this is to perform an action while recording a macro (using Tools / Macro / Record temporary macro).
When I have finished with the action, I look at the source code of the macro and it usually helps to find the correct command.
For example, I have just let R# add some magic through Alt-Enter, and the macro recorder has:
DTE.ExecuteCommand("ReSharper_QuickFix")
You can rebind all of the ReSharper shortcuts by using the ReSharper -> Options -> Visual Studio Integration page. Select a keyboard scheme and hit "Apply Scheme".

Resources