How to open two / multiple instances of Visual Studio for MAC? - macos

I wish to open multiple instances of VS for Mac. I used to be able to do this with Xamarin studio using the Xamarin launcher.
How to do this with VS for Mac?

Open a terminal window, and then issue the following command:
open -n -a "Visual Studio"

Alright, at last!, Microsoft has just implemented the simplest solution of all in Visual Studio 2019: just right click on its icon on the launch bottom bar, and choose "New instance":
See the details of the feature in the release notes of VS2019 for Mac Preview.

There is also the option of opening multiple solutions in the same Visual Studio instance.
From Recent list: Hold Ctrl while clicking the solution name
From File -> Open: Single click the .sln file, click Options and uncheck Close Current Workspace.
Credit: https://www.jimbobbennett.io/opening-multiple-solutions-in-visual-studio-for-mac/
Note. the active project(For run/debug) changes depending on which file you have marked/selected/editing.

If you don't want to daily search for this specific terminal command, create a script as below:
Open "Script Editor" in Mac
Paste: do shell script "open -n -a 'Visual Studio'"
Save this file somewhere (On Desktop)
Whenever need to launch another instance, simply open this file and
click on "Run the Script" button
Screenshot Here

Visual Studio Code
Version: 1.39.2

Official documentation: How do I open multiple solutions or instances of Visual Studio for Mac?
Open a second solution inside a single instance
To open a second solution alongside your first solution, use the following steps:
With your first solution already open, select File > Open.
Select the solution and press the Options button.
Uncheck the Close Current Workspace button:
Press the Open button to open the second solution in the Solution Pad.
Alternatively, if you have recently opened the solution, you can do the following:
Go to the File > Recent Solutions menu item:
Hold down the Ctrl key and select the solution. This combination opens the second Solution in the Solution Pad
Open a second instance
To open a second instance of Visual Studio for Mac, open the Terminal application and enter
open -n "/Applications/Visual Studio.app"

Based on #moke and #MilanG answers, I created a bash file on my desktop with this content:
#!/bin/bash
open -n -a "Visual Studio"
osascript -e 'tell application "Terminal" to close first window' & exit
I named this file "Visual Studio".
Then I made the file executable on double-click by following this procedure https://stackoverflow.com/a/5126052/3819725
As a last step, I re-used the Visual Studio icon for the bash file on my desktop so that I instantly know what to click on. I did this:
Right click on the bash file you just created and select "Get Info". An information panel opens with an icon in the top-left corner.
Open a new Finder window and position it next to the "Get Info" panel you just opened
In the Finder window, navigate to "Applications" and select "Visual Studio" from the list of applications.
Right click on the "Visual Studio" application icon and select: "Show Package Contents".
Navigate to "Contents" -> "Resources" and select the "VisualStudio.icns" file.
Drag this file to the icon in the top-left corner of the "Get Info" window you opened in step (1)
Voila - you now have a clickable desktop icon with the visual studio icon that opens a new instance of Visual Studio for Mac and does not leave a Terminal window open.

I am using MSSolutionLauncher for opening multiple instances of Visual studio for Mac. The github page of the project is Here. Download latest release and double click to unzip. Now keep the app in desktop and click on it to open new instance of the Visual studio for mac as many times as you want.
EDIT
Starting from Visual Studio for Mac 2019, MSSolutionLauncher is not required. Keep the VSMac Shortcut in Dock. Right Click the Dock Icon and select New Instance.

Clone the Application!
Open Finder
Navigate To Applications
Select Visual Studio
Edit > Copy
Edit > Paste
Open the copy

Posted my solution here:
https://stackoverflow.com/a/62831584/2621976
just do
open -a "Visual Studio" \
"path to first sln" \
"path to second sln" \
...

Just hit Shift+Command+N (Or go to "File > New Window" and it will open a new window. You can then drag files from one to the other.
I was trying to do the same thing which led me here. I didn't have luck with the highest-rated solution and then the above occurred to me. Unless I'm missing something more to the original request? Seems like the most obvious solution.

This is VS code (not VS4Mac as per comment below). But found this forum in my own search so might be useful.
open -n -a "Visual Studio" gave error "Can't Find Application Visual Studio", so I just did:
Open a visual studio project
To get another, right click (two finger press) on visual studio docked icon
Click "New Window", and now you have two instances

Related

Shortcut in Visual Studio to open solution in Windows file explorer?

Is there a keyboard shortcut in Visual Studio (currently using 2013) to open the solution (or a project) in the Windows file explorer?
Currently, I normally have to open up the Solution Explorer, right-click on my solution or a project and scroll down to 'Open Folder in File Explorer', but this becomes a time consuming task as I have to do it often (TortoiseGit not integrated with my IDE).
An improvement over #Walt_Ritscher's answer I found was to assign a keyboard shortcut to the File.OpenContainingFolder.
Instead of having to first select a project or solution from the solution project I can simply press a desired keyboard shortcut while any file is in focus (without having to open the Solution Explorer) and it will open the file location in Windows Explorer. This saves time if the focus in my solution explorer is on a file deep in the structure of my solution explorer since I don't have to scroll all the way back up to select a project/solution before hitting the keyboard shortcut.
Yes, you can add your own keyboard shortcut to open the folder.
Open the Tools/Options/Keyboard dialog. In the Show Commands Containing textbox, type OpenFolderIn and you will see the OpenFolderInFileExplorer command. Select the command, then assign a shortcut key. Move your cursor to the Press shortcut keys textbox.then press your desired key combination. In my example I chose Ctrl+Shift+'. Be sure and click the Assign button to memorize the shortcut key
Press OK and you're done.
For visual studio vs2017:
Ctrl+Shift+Alt+O

Unity3d 4.5.2 integration with monoDev

I am new to unity platform. I am having visual studio 2008 and unity 3D v4.5.2 working side by side. When ever i create a C# script and opens it to edit, it opens in visual Studio but not in monoDev even i have set the preferences to MonoDev built in and synchronized Assets with MonoDev. but still it opens in VS 2008. All i want is to open in MonoDev but not in VS. Ive searched it but not finding any particular solution to the problem.
Unity Preferences -> External Tools -> External Script Editor and instead of selecting the "Monodevelop (Built In)" option select "Browse" and go select the app exe file yourself and to debug in Monodevelop in Unity 4.3, you need to to tick the options "Development Build", and "Script Debugging" in the Build Settings panel
If you double-click a .cs file in Windows Explorer, does it open Visual Studio? If so, try making the default editor for .cs files the Mono IDE.
Hold Shift, then right-click a .vs file, then pick the "open file with" (or similar) item to permanently assign a new editor to .vs files.
i had the same problem and i broke my head but found the simplest solution
please follow
Open Unity
Go to Edit (Second Tab)
Click on Preferences (A new Tab will open )
Click on External Tools (Second Option Available)
Choose from the list of options Available
AND YOU ARE DONE (Make sure your option of the editor is Installed first LOL)
Click on the "Edit" tab:
Then find "Preference" in the available options. You will find such a mini window opening up, as in the picture below:
Then click on the second option, "External tools":
Then choose from the list of options available (if you have Mono Develop installed then it will be already selected for you)
My suggested options are:
Visual Studio
Mono Develop (usually I have to force close the first time , but I am comfortable with Mono Develop because of its light-weight and powerful performance compared to Visual Studio)
Notepad++ (for the pros)

How do I add a default Run As Administrator when I open a sln file from the command prompt or Windows 7/8 Jump List menu?

I have been researching around the web trying to figure out how to add Run As Administrator as the default menu item for a Visual Studio solution when you:
right-click the solution in Windows Explorer
right-click on a pinned application, such as Visual Studio 2013, to bring up the Jump List and then select the solution
The instructions that I have found so far:
http://www.howtogeek.com/howto/windows-vista/add-run-as-administrator-to-any-file-type-in-windows-vista/
show how to easily add the Run As Administrator menu item to an existing file type. You just have to find the right registry keys for the Visual Studio version that you're working with. For example, Visual Studio 2013's registry key for its solution file type is:
[HKEY_CLASSES_ROOT\VisualStudio.sln.12.0]
Then you just copy the Open command under the shell key, then paste it in as a new key whose name is runas.
After that change, when you right-click on the solution in Windows Explorer, Run As Administrator is in the list of commands. But it is not the default.
To open the solution as Administrator from the Jump List menu, when you right-click on Visual Studio as a pinned icon, you have to right-click on the solution file in the Jump List, then select Run As Administrator.
But I couldn't find anywhere about how to make the Run As Administrator the default command in this menu.
So how do you do that?
Easiest way is doing this:
Right click visual studio and open file location.
(If it's the shortcut, right click then click properties. On the bottom click on "Open File Location")
This should lead you to devenv.exe.
Right click this and select troubleshoot compatiblity.
Select troubleshoot program and check off the box for "The program requires additional permissions" and select next.
Now if you open visual studio from where ever, it'll open it as an administrator.
It actually turns out to be one additional registry entry that needs to be set. In the shell key under the file type, change the value of (Default) to be the same name as the command in the registry under the shell folder.
For example, to set Run As Administrator to be the default, you would set the value of (Default) in HKEY_CLASSES_ROOT\VisualStudio.sln.12.0\shell to be runas.
When exported, this setting looks like this:
[HKEY_CLASSES_ROOT\VisualStudio.sln.12.0\shell]
#="runas"
Now when you right-click the solution in Windows Explorer, or when you right-click the solution after right-clicking to bring up the Jump List on the Visual Studio 2013 pinned icon, Run As Administrator is the default command instead of Open.
So you can confidently open the solution itself from Windows Explorer or the Jump List menu and watch as Visual Studio opens as Administrator.
Updating answer for Visual Studio 2015 (under covers version "14.0"). Tested on on Windows 10 Pro v1703 Creators Update. Picture below illustrates the first registry change. Second change goes one better - no need to right-click the jump list item at all.
Windows Registry Editor Version 5.00
;To add "Run As Administrator" to Visual Studio 2015 Taskbar Jump List solution right-clicks
[HKEY_CLASSES_ROOT\VisualStudio.sln.14.0\shell\RunAs]
[HKEY_CLASSES_ROOT\VisualStudio.sln.14.0\shell\RunAs\command]
#="\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\devenv.exe\" \"%1\""
;To make Jump List solutions open As Administrator by default
[HKEY_CLASSES_ROOT\VisualStudio.sln.14.0\shell]
#="runas"

Visual Studio Team Explorer can't properly open a PDF file - Solution Explorer not available for "open with" setting

We have PDF (and other) files attached to TFS Work Items and in Source Control under TFS. They are not opened correctly (they show up as ASCII, basically) in Visual Studio.
The problem seems to be that until you use the 'Open With..' dialog from the Solution Explorer, VS doesn't properly associate a program with extensions like '.pdf'.
If our users had a full installation of Visual Studio, that would be an ok work-around. However, many of them only have Visual Studio 2013 with the Team Explorer component - no Solution Explorer at all.
I'm guessing that there must be some workaround for this case. Perhaps setting the proper registry value? Since VS properly remembers the association if you can tell it (through the Solution Explorer), it must be stored somewhere.
Ideas? Suggestions?
If you've got a PDF file in a project you can right-click in the solution explorer and choose "Open with..". Now you can choose which editor you want to use. If Acrobat isn't already listed you can add it and after that click the button "Set as default".
After that, your PDF's will always open with Acrobat Reader regardless if you open it from source control browser or elsewhere in the Visual Studio. But you need to configure that for all your Studios.
Reference: Answer in MSDN "Source Control Explorer Doesn't View PDF Files"
"Open with" is not available in context menu. But I found solution - well better said workaround:
You have to create external command to open this pdf file in you pdf viewer.
Go to Tools/External tools.
In command section, enter path to your PDF viewer (exe file)
In Arguments, choose "Item path". Save it under preferred name
Put this new command you created in some of existing toolbars or create new one for it. This is also little complicated, so here is how:
Hit the small arrow next to the existing toolbar, choose customize
In the new window, choose "Add command"
In the new window, your new command is hidden under the category "Tools" as command "External command 1". Add it and confirm.
Now here comes the nasty trick. This command will not work in the browser window with PDF file selected, the argument is empty :(
So you have to OPEN the pdf file into that ASCII window and THEN hit the new command. Now the file will open in you selected pdf viewer.
Hope this will help someone

Is there a Visual Studio option or add-on to add an "Open Explorer Here" when I right click on a project in the solution folder?

When I right click on a project in the solution explorer I'd like to be able to select an option that would open a new windows "Explorer" that lists the contents of the build directory. I'd settle for the project directory... but getting me into /bin/x86/Debug vs /bin/x86/Release based on the active build configuration would be major bonus.
I find myself manually navigating to that folder fairly often for various reasons - usually on Utility applications which don't have installers / cmd line build scripts etc
I currently use 2005 express. But, am open to upgrading.
A couple things that might be close enough:
add an "external tool" to the Tools menu. In the "Tools | External Tools..." dialog:
Click "Add" and give the new tool whatever name you want
Command: %systemroot%\system32\cmd.exe
Argument: /k "c:\Program Files (x86)\Microsoft Visual Studio 8\VC\vcvarsall.bat" x86
Initial directory: $(TargetDir) // (or whatever appropriate macro)
Right click on a open document's tab and select "Open containing folder"
My VS 2005 Standard IDE already had a "Visual Studio 2005 Command Prompt" tool, but it landed the command window in the VC installation directory. Changing the "Argument" and "Initial directory" fields as above made it land in the project's target directory.
The drawbacks are they don't show up in the right menu for the project and they might not land you exactly where you want, but they should land you pretty close.
No sure this is what you want but the "Open file" icon will pop up a FileOpen dialog in the project folder. From there you can right click the Release or Debug folders to open them in an Explorer (and Cancel the dialog).

Resources