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? - visual-studio

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).

Related

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

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

How to make visual studio project into exe file and give UI

I have a code which detects the FACES from the image file (C++ file). I am using Visual Studio-2010 and OpenCV-2.4.10 for this project.
Now I want to create an EXE file and I want to give User Interface which will ask the user to upload an image and produces the Output image back on to the User Interface.
So how can I do this.
Please help me in this regards.
Thankz in advance.
To build a solution that's open in Visual Studio and selected in Solution Explorer, you can:
On the menu bar, choose Build, Build Solution.
Or, in Solution Explorer, open the shortcut menu for the solution and then choose Build Solution.
Or, press F7. (This is the default keyboard shortcut for the C/C++ development settings.)
Or, in the Command Window (on the menu bar, choose View, Other Windows, Command Window), enter Build.BuildSolution.
Or, in the Quick Launch box, enter build build solution.
To build a project that's selected in Solution Explorer, you can:
On the menu bar, choose Build, Build .
Or, in Solution Explorer, open the shortcut menu for the project and then choose Build.
Or, in the Command Window (on the menu bar, choose View, Other Windows, Command Window), enter Build.BuildOnlyProject.
Or, in the Quick Launch box, enter build project only build only .
You can then navigate to the build location, either /debug or /release depending on the option you have chosen, you will find your .exe there
You need to use Publish from right-clicked project in Solution Explorer

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

How can I find out the value of $(ProjectDir)?

Where can I execute and find out the value of $(ProjectDir)?
To find out what it is right now (rather than at build time, where it may be different depending on what is going on):
right click on your project in the Solution Explorer, select Properties
select the Build Events tab
click the Edit pre-build or Edit post-build button, either is fine
in the window that pops up, click the Macros button
scroll down the list till you find ProjectDir, in the next pane is its actual value
Do a pre/post build step.
Example:
echo $(ProjectDir)
The answer from slugster did not work for me (most possible my fault).
In Visual Studio 2008
right click on your project in the Solution Explorer, select Properties
Go to Configuration Properties and then to Debugging
Click on the arrow in the Command Field and click the Edit Button
In Edit clik "Macros>>" You will see there the values of ProjectDir... etc..
In Visual Studio 2015, you can find ProjectDir by clicking on Macros in additional Include Directories and then clicking on Macros (for me there was nothing in Build Events) :
Open the project properties (Alter+Enter) and then go to "Build Events", select any of the build events, then select "Command Line", click "Edit", then press the "Macros >>" button.
Same here in Visual Studio 2019, you can find ProjectDir by clicking on Macros in additional Include Directories and then clicking on Macros (for me there was nothing in Build Events), like the answer in above Visual Studio 2015.
For me it was the path to the directory containing *.vcxproj file.
From https://learn.microsoft.com/en-us/cpp/build/reference/common-macros-for-build-commands-and-properties:
The directory of the project (defined as drive + path); includes the
trailing backslash ''.
Tools -> External Tools
create command for Powershell.exe or Csc.exe
copy exe to c:\ for shorter paths
Name it and check Prompt for arguments
now click Tools -> Click name of your tool
with dialog displayed, click Argument button and choose $(ProjectDir) or whatever.
Your $(ProjectDir) is displayed in Command Line after Powershell.exe or csc.exe
Clear Arguments and click argument button again
Your next selection is display again after command (repeat to view all 16 environment variables.
this is without executing command but command is required to save.
if you use csc.exe from this path
"C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\Roslyn\csc.exe"
copy Roslyn folder to
C:\Roslyn
csc.exe needs other files to work, you need whole directory.
Roslyn folder is only 34 Mb

Resources