Using the command line from within Visual Studio - visual-studio

I'd like to have a tool window in Visual Studio that allows me to type command line things (e.g. git stash, npm install, etc.) in the current project's working directory. Something like this in Eclipse.
I can't find any such option in any of the menus, but admittedly they're labyrinthine. I tried looking through the Visual Studio gallery, but no dice either. Any extension or hidden option that would give me this?
PowerShell would probably also work, as from what I understand that's a superset of the regular shell.

In Visual Studio 11, the NuGet Package Manager Console is a fully featured PowerShell console. You can do all kinds of things there, including file system operations, git/hg/svn/tfs commands, etc.
You also can customize the experience with a special PowerShell profile called NuGet_profile.ps1.
Installing the NuGet VSIX from the Visual Studio gallery will get you a similar experience in VS2010 if I'm not mistaken.

For anyone that comes across this in 2018+, there is now also the Whack Whack Terminal extension from Microsoft's Daniel Griffen (#dgriffen on GitHub), which gives you exactly what you were looking for.
Whack Whack Terminal is a terminal emulator for Visual Studio 2017. Unlike other terminals for VS, Whack Whack Terminal is fully interactive. Users can launch interactive git commits, vim, or almost any other command line utility.
The default terminal is powershell and it can be opened with the shortcut chord "Ctrl+\, Ctrl+\".
CMD and WSLBash are also available terminal choices.
It's also open source! You can find the source code at Microsoft/WhackWhackTerminal on GitHub.

There is a command window in Visual Studio (CTRL + ALT + A) or (View -> OtherWindows -> Command Window)
You can then use the shell command to run external executables
The syntax is:
shell [/command] [/output] [/dir:folder] path [args]

You can download PowerConsole from the Visual Studio extensions gallery.

Related

Can visual studio code block modifications like vim?

Is it possible to lock files in visual studio code? Similarly to what you do in vim where you have to press "i" if you want to modify files I'd like to be able to keep the files locked and then press a key that allows me to modify them and then lock them again. Is it possible to do so in visual studio just like in vim?
It looks like you're looking for a "modal editor" interface.
If using actual Vim keybindings and commands would work for you, then consider adopting Vim for VS Code, which emulates most of the Vim UI inside VS Code.
It should give you the best of both worlds.

Command to open another instance of integrated terminal on Visual Studio Code?

This question is specifically for Visual Studio Code (VS Code) and it's integrated terminal.
Is it possible to open another integrated terminal to run certain commands from npm scripts or from within one terminal?
For example: if the command "Start cmd" is executed, it opens a new separate window. But, is it possible to force that command to open and run inside another integrated terminal within VS Code?
Note:
There are keyboard shortcuts avaiable to open, close, show, hide etc, but this question is asking about performing these actions from code or command not using keyboard shortcut.
Visual Studio code has nice keyboard shortcuts for opening new integrated terminal instances:
For Windows:
Ctrl+Shift+`
For Macintosh
Ctrl+Shift+~
For more information on shortcuts take a look here for Windows and here for Macintosh. At least this way you can run any command you want in multiple instances. For example, run your server in one integrated window, and other one off commands in another instance, etc...
Hopefully that helps!

how fully remove Visual Studio

Please tell me how to fully remove Visual Studio with all components and also remove registry(Any batch file or any Command which runs from Command prompt)
Go to Programs and Features (in Control Panel)
click on 'Microsoft Visual Studio {your distribution e.g. Pro/Ent etc} 20XX'
click on Change
click Uninstall
Do the same for all other existing Microsoft Visual Studio components in that list.
EDIT:
based on your comment below, I'd suggest you to use Windows 7 Manager or Windows 10 Manager based on your OS, its quite handy and fast, it even cleans registry as well. I've personally had good experience with it.

How Can I Paste Text From Another Application Into Visual Studio with Emacs Emulation Extension?

After copying text from another program, when I switch to Visual Studio with the Emacs Emulation extension and try to paste the text, none of the following methods work:
Ctrl-Y (Emacs emulation extension keybinding for 'yank' [paste])
Clicking paste on the toolbar
Edit > Paste
Right click > paste
How can I paste text from an outside application into a copy of Visual Studio that is running the Emacs Emulation extension?
As above - Ctrl-Shift-Ins (Edit.CycleClipboardRing) does work for this (at least it does for me having got the emacs add-in to load in VS2012,) so you can then go into Tools->Options, select Environment->Keyboard, and remove the Ctrl-Y shortcut, then assign Ctrl-Y to Edit.CycleClipboardRing.
Repeating Ctrl-Y does cycle the clipboard ring, which is a side-effect I can live with... I guess if you reassign Alt-Y to be the same command then generally this will do what you expect.
Ctrl-Shift-Ins (Edit.CycleClipboardRing) will paste the contents of the Windows clipboard into Visual Studio.
As far as the other, more standard methods not working, this is a known bug in the Emacs Emulation extension. From the extension's Visual Studio Gallery page:
Cut/copy/paste from other applications into Visual Studio does not work with the Emacs extension installed. We're working on a fix for this issue and will post an updated version of the extension when a fix is available.

How do I force Visual Studio 2008 to use an Open instance when double clicking a file?

Certain non-project files that I use Visual studio for (.build, .xml, free-roaming html and css files) are already associated with visual studio and open in it when i double click them.
How can I get them to open in an existing instance of visual studio? Right now If i double-click the same file twice, it will open two instances of visual studio, I'd like it just to basically ignore the second open attempt if there is already an instance of VS open.
Windows 7 vs2010 answer;
Because "Default Programs > Associate a file type or protocol with a program" is so useless, use regedit.
Navigate to HKEY_CLASSES_ROOT\VisualStudio.XXX.10.0\shell\Open\Command and add /edit to the end of the open with line, where XXX is the filetype you wish to affect.
Example .reg file for .cpp;
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\VisualStudio.cpp.10.0\shell\Open\Command]
#="\"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\devenv.exe\" /dde /edit"
Ok Richard helped point me in the right direction a bit, but I think I found exactly what I want.
from an explorer window, go to Tools->Folder Options->File Types tab
find the extension you wish to change.
If there is a restore button click it.
Click Advanced
Click New... to create a new action.
I set the following:
Action: Open in VS 2008
"C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe" /dde
check use dde
DDE Message: Open("%1")
Application: VisualStudio.9.0
DDE Application Not Running: (left blank)
Topic: System
Hit Ok
Set the new action as the default.
Hit Ok, Hit Ok
Now that extension will behave exactly as described in the question. The file will open in an existing VS if visual studio is already open.
I also used this to fix a few extensions that got broken when I reinstalled VS 2005 after 2008.
Win 7/ VS 2012
You can right click a file, go to properties.
Then there is an "Opens With" line and a change button. But I don't see a way to force other command line options. VS2012 seems to use the open instance by default.
Which version of VS?
For 2003, there's VSEdit.
In 2005, well, that's the way it works for me out-of-the-box. A quick Google search found something that may help.
Hope that helps.
Later versions of Visual Studio also seem to have problems opening files via DDE from certain applications (e.g. in SSHCommunications' Secure File Transfer Client; Winzip and explorer seem to work fine). This still happens with the solutions given previously.
When IDE already loaded, the IDE focuses but gives error 'The template specified cannot be found. Please check that the full path is correct'
When IDE not loaded, it intermittently gives error 'The file cannot be opened because it is being used by another process. Please close all applications that might access this file and try again'. Trying again proceeds as 1)
You can get it working in all situations using a combination of all the previous posts!
Install the VSEdit application (as suggested by Richard/Jeff for .Net 2003), regardless of the version (or versions) of msdev that you use: the post by Sara Ford to which they refer recommends VSEdit for command line operation in VS2005 - it also seems to work for later versions.
Alter the DDE (Tools->Folder Options->File Types) as Jeff proposes but to open via VSEdit.exe instead of devenv.exe directly. Specifically:
Action: Open "C:\Program Files\PowerToys for Visual Studio .NET
2003\VSEdit\VSEdit.exe" /c "C:\Program Files\Microsoft Visual Studio
9.0\Common7\IDE\devenv.exe /Edit """%1"""" "%1" use dde: (checked) DDE Message: (left blank) Application: VSEdit DDE Application Not
Running: (left blank) Topic: System
N.B. The triple/quad quotation marks are deliberate - they add the first opened file (quoted) to the end of the launch command to prevent msdev complaining about the command line usage of the /Edit mode if launched. Obviously command paths will need changing for different installations.

Resources