How to open files in one instance using Visual Studio? - visual-studio

I edit files directly from FTP and like to use Visual Studio, however VS seems to open each file in a new instance of VS instead of a new tab. I believe this is because it's a file without a solution/project.
How can I force VS to open multiple separate files inside one multitabed window?

You should perhaps look into this command line option : http://msdn.microsoft.com/en-US/library/aa991989(v=vs.100).aspx

I had the same problem This worked for me :
In Filezilla go to Edit > Settings > File editing
on the "Use custom editor" radio button, enter the following:
NB: the space between quatation mark and forword slash is important
" /edit
"C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe" /edit
or
"C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe" /edit

Related

Load a solution on launching Visual studio 2012

I have added Visual studio to my startup folder in windows, now I want that when it launches it should load a particular solution by default. So that I don't have to check from the recent projects and select them.
So when my windows starts it launches visual studio and loads this solution and I am ready to code.
You can add a shortcut to your .sln solution file to the startup folder instead of a shortcut to VS. It will load VS with this solution.
If you already have devenv.exe added in startup, the next step is to add the argument with the path to the solution.
Right click the shortcut to devenv.exe under your startup folder.
Click properties.
Update the target field from
"C:\Program Files (x86)\Microsoft Visual Studio
11.0\Common7\IDE\devenv.exe"
to something like this
"C:\Program Files (x86)\Microsoft Visual Studio
11.0\Common7\IDE\devenv.exe" "C:\Your path\HelloWorld.sln"
You can see additional information about Devenv Command Line Switches here.

Where is Developer Command Prompt for VS2013?

I need to run web.exe file from my developer command prompt in Visual Studio 2013. By default, the command prompt is not installed in Visual Studio 2013.
Previously, I was using Visual Studio 2012. It had developer command prompt installed by default.
Does anyone know why VS2013 doesn't have developer command prompt by default? How can I setup developer command prompt for VS2013?
For some reason, it doesn't properly add an icon when running Windows 8+. Here's how I solved it:
Using Windows Explorer, navigate to:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2013
In that folder, you'll see a shortcut named Visual Studio Tools that maps to (assuming default installation):
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts
Double-click the shortcut (or go to the folder above).
From that folder, copy the shortcut named Developer Command Prompt for VS2013 (and any others you find useful) to the first directory (for the Start Menu). You'll likely be prompted for administrative access (do so).
Once you've done that, you'll now have an icon available for the 2013 command prompt.
From VS2013 Menu Select "Tools", then Select "External Tools". Enter as below:
Title: "VS2013 Native Tools-Command Prompt" would be good
Command: C:\Windows\System32\cmd.exe
Arguments: /k "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat"
Initial Directory: Select as suits your needs.
Click OK.
Now you have command prompt access under the Tools Menu.
I used a modified version of this answer - based on my experiences adding it to VS 2010:
Select Tools >> External Tools in Visual Studio
Click Add
Title: I use Visual Studio Command &Prompt
&P Makes P a alt-shortcut key (when menu active)
I originally used C, but that conflicts with the existing shortcut for Customize
Command: C:\Windows\System32\cmd.exe
Arguments: \k "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\vsvars32.bat
/k keeps a secondary session active so the window doesn’t close on the .bat file
Initial Directory: I use $(ProjectDir) (from the dropdown)
Click OK.
Now you have command prompt access under the Tools Menu.
See also: Add command prompt to Visual C# Express 2010
You can simply go to Menu > All Programs > Visual Studio 2013. Select the folder link "Visual Studio Tools". This will open the folder. There is bunch of shortcuts for command prompt which you can use. They worked perfectly for me.
I think the trick here might be there are different versions for different processors, hence they put them all together.
I don't know if this changed recently -- the answer given by Samuel did not apply to me even though that link seemed authoritative.
A couple of things
1) For some reason, the folder in the start menu is called Visual Studio 2013, and not Microsoft Visual Studio 2013. Using the win8 apps interface you might see the 2010 entry Microsoft Visual Studio 2010, and since you don't see the new 2013 folder Microsoft Visual Studio 2013 next to it, you assume it isn't there. But it is.. Just a few page scrolls away..
2) It seems the Windows 8 (or 8.1 at least) cannot display sub-folders. I tried creating a folder underneath the Visual Studio 2013 folder with shortcuts, and the entire folder just didn't show.
3) Which is why what is installed is a shortcut. Not sure what the windows 7 behavior is with a shortcut in the start menu, but the apps menu just displays it like a folder. When you click on it, it brings you to the so-called missing shortcuts in explorer.
Final solution: under C:\ProgramData\Microsoft\Windows\Start Menu\Programs, create a new folder called Microsoft Visual Studio 2013. Copy the shortcuts from C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts to that new folder. Then you'll have your icons using the windows 8 app interface under the heading which is the new folder name.
You'll also be able to just start typing from the start screen VS2013, and the icons will now show up.
Since any solution given so far will open the command prompt on the project folder, you would still have to navigate to the project's folder. If you are interested in getting the command prompt directly into the project's folder, here is my 2 steps:
Right-click in solution explorer on the project name (just under
the solution name) and choose the command "Open Folder in File
Explorer"
Once the Windows Explorer is open, just type in the
address bar "cmd" and then hit enter!
Et voila! Hope that helps
Visual studio command prompt is nothing but the regular command prompt where few environment variables are set by default. This variables are set in the batch script : C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat . So basically to get a visual studio command prompt for a particular version, just open regular command prompt and run this batch script : C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat (Change the visual studio version based on your installed version). Voila you have got the visual studio command prompt. You can write a script to run the batch file and open cmd.exe.
Works with VS 2017
I did installed Visual Studio Command Prompt (devCmd) extension tool.
You can download it here: https://marketplace.visualstudio.com/items?itemName=ShemeerNS.VisualStudioCommandPromptdevCmd#review-details
Double click on the file, make sure IDE is closed during installation. Open visual studio and Run Developer Command Prompt from VS2017
I'm using VS 2012, so I navigated to "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Visual Studio 2012\Visual Studio Tools" and ran as administrator this "Developer Command Prompt for VS2012" shortcut. In command shell I pasted the suggested
aspnet_regiis -i
and as I suspected this did not yield any success on Windows 10:
So all I needed to do was "Turn Windows Features On/Off" at Control Panel and restart my machine to effect the changes. That did resolve the issue. Thanks.

LIB library /EXTRACT:member /OUT:objectfile

Where do I run this syntax? There's no command line on Visual Studio. I know this is a simple question but so far I couldn't find the answer.
Usually, after installation of Visual Studio, you have a submenu entry inside the Microsoft Visual Studio program group called Visual Studio Tools. In this submenu you could find a couple of Command Prompt for ... menu that launch a command window with specific path set to the Tools installed with Visual Studio, including the LIB tool
For example, this is the command executed by one of mine menu entries
%comspec% /k ""c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86_amd64

Starting Visual Studio from a command prompt

I have three different versions of Visual Studio installed on my machine,
Visual Studio 2003, Visual Studio 2008, and VS2005.
How do I start a particular version of Visual Studio using a command prompt?
devenv.exe opens the latest version of Visual Studio. What should I do if I want to open Visual Studio 2003 using a command prompt?
Haven't tested on preceding versions - but to launch Visual Studio 2019 you can just enter start devenv to launch right away without entering into a path
You have to use the path to distinguish them. For instance, here is the Visual Studio 2005 command on my laptop:
"C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe"
Here's another tip: You can figure out how to run various Windows applications from the command line by finding them in the Windows Start Menu, right-clicking on the icon, select properties, and then on the Shortcut tab, look at the Target textbox. Copy that text out and usually you can use it at a console command line.
This answer is a different way to handle starting Visual Studio in any version of Windows, by using the Windows Key {windows logo} start to start the target application.
Pin each version to the task bar. One way is to right click an active running program and select 'Pin to Taskbar. Or find in the program manager and right click again to pin.
Pin each different version right next to the task bar. For this example pin each version in succession 2003, 2005 and finally 2008. Make sure they are next to the start button for easier index number memorization.
To launch the 2003 version hit the WindowsKey then number 1.
To launch 2005 WindowsKey 2.
To launch 2008 WindowsKey 3.
This is fast and easy and can launch multiple instances without bringing up the command console.
Use devenv.exe for the specific version of Visual Studio. There will be one located in the Common7\IDE folder of the install. Here are the directories as I remember for the various versions.
2008:
%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\Ide\devenv.exe
2005:
%ProgramFiles%\Microsoft visual Studio 8\Common7\Ide\devenv.exe
For Visual Studio on a mac, you can:
open '/Applications/Visual Studio.app' [path_to].sln
I create an alias in my bash_profile so I can just navigate to a directory and open it in VS:
echo "alias vs=\"open '/Applications/Visual Studio.app' *.sln\"" >> ~/.bash_profile
Here is the shortcut, You can just type devenv.exe and start visual studio
You can also use the "Visual Studio 2005 Command Prompt" and "Visual Studio 2008 Command Prompt" to load a version-specific command shell environment, and then run devenv. This is typically found under Start -> Programs -> Visual Studio -> Visual Studio Tools
If you can't or don't want to access it via the Start menu, you can also "load" the VS-version specific environment in a normal command shell using the following (for VS 2008,
with a default install path): (note: change x86 as appropriate for your platform)
(32 bit) %comspec% /k ""C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"" x86
(64 bit) %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 8\VC\vcvarsall.bat"" x86
or for VS 2008 (with default install path):
(32 bit) %comspec% /k ""C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" x86
(64 bit) %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" x86
Each sets the environment so if you then subsequently execute devenv it'll load the correct version.
Put C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ in the path of your computer.
Then open a new command prompt.
Change the directory to your project folder.
Type devenv to open the project in Visual Studio from the command prompt. This opens the project up in folder view. It has to have a .sln file to do the next part.
Click the switch views drop-down arrow and choose the .sln file.
The solution explorer will now display the solution.
Use an abolute path, for example, C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe.
1) devenv (to open VS)
2) devenv *.sln (then tab to autocomplete and enter to open VS and auto-load current solution)
By default, this only works in Developer Command Prompt.
To make it work in a normal console (I use cmder) you need to add folder path to devenv.exe to the System environment variable name Path.
For me that is this one:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE
You can also use this script and save it as vs.bat and then it will find for you *.sln file in the folder and automatically open visual studio with solution loaded (as in 2.)
Similar question where I answered: Visual studio: How to open a specific solution directly from command line?
Essentially use OpenVSSolution
Put this helper exe somewhere in your PATH
The exe scans the current directory for a .sln file
The exe opens devenv passing in the sln file
The explanation is on here: https://davemateer.com/coding/2018/11/14/Publish-dot-net-core-console-application.html
I find this incredibly useful and is how I open all solutions.
Use Window Terminal (https://github.com/microsoft/terminal), run these commands in the terminal
cd your-project-folder
.\your-solution.sln
I tried the answer that has been accepted in this question but it didnt work for me
I was able to launch Visual studio from RUN by typing devenv.exe in it.
WIN+R didnt work for opening RUN, so in command prompt, I typed the below path in command prompt
c:\WINDOWS\system32\rundll32.exe shell32.dll`,#61
use this command:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe
You can create a bat script for any visual studio version. You can find my script below.
start /B "" "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\devenv.exe"
Even, you can create an alias following this post
Go to your project directory in cmd. (ex. cd <=FOLDER_PATH=>)
type code and press enter.
To open it with Visual Studio Express 2012 for Windows Desktop do -
%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat""
%comspec% is:
C:\Users\Admin>echo %comspec%
C:\Windows\system32\cmd.exe
Or just search "developer" in the Windows 8 Start Search "Apps" menu, and it will lead you to "Developer Command Prompt for VS2012".

How can I delete bad Visual Studio templates?

How do you remove the following noise templates that don't even work?
In Visual Studio: go to Tools > Extensions and Updates and then uninstall or disable the template.
To save a bit of time for 2010 users, the folder has moved:
...\My Documents\Visual Studio 2010\Templates\ProjectTemplates
For Visual Studio 2013, I found my template cache here:
%USERPROFILE%\AppData\Roaming\Microsoft\VisualStudio\12.0\ProjectTemplatesCache
Deleting them off of disk should do the trick. Where they exist will depend a bit on where you installed them. If you installed them for all users they will be at
%ProgramFiles%\Microsoft Visual studio 9.0\Common7\Ide\ProjectTemplatesCache
For a single user they will be at
%USERPROFILE%\Visual Studio 2008\Templates\ProjectTemplates
EDIT
If InstallVSTemplates fails, it is likely one of the following. The one I can't help with is some program randomly dumping files inside of the ProjectTemplatesCache directory.
The other more likely cause is there is a bad template in the ProjectTemplates directory. InstallVSTemplates really just goes through this directory, and unzips all of the files into the ProjectTemplatesCache directory. You will have to search through this directory and find the .zip file which contains the junk files being added to your project Once you find the file, delete it, delete ProjectTemplatesCache, and then re-run InstallVSTemplates.
After manually searching for some of the custom profile templates(.vstemplate),I found them at the following location:
%userprofile%\AppData\Local\Microsoft\VisualStudio\10.0\Extensions
It appears VS2010 installs some of the templates as extesions or the authors made it that way.I hope this helps someone.
May need to run "devenv /setup" at the run command to refresh the VS2010 after you delete the templates.
For me it was a matter of removing it from here using VS2017:
%USERPROFILE%\AppData\Roaming\Microsoft\VisualStudio\15.0_45552a03\ProjectTemplatesCache
Delete the bad/unwanted project folders from
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates
Clear cache
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplatesCache
Delete stuff from (perhaps not necessary)
C:\Users[Your User Name]\Documents\Visual Studio 2008\Templates\ProjectTemplates
and finally open Visual Studio 2008 Command Prompt as Administrator and run
devenv /installvstemplates
For me the issue got resolved when I deleted the cache.bin file from ItemTemplatesCache folder. Full path of this folder is:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplatesCache
Also make sure you delete the template files from below locations:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplatesCache
C:\Users\Default\Documents\Visual Studio 2010\Templates\ItemTemplates
C:\Users[NT-USERNAME]\Documents\Visual Studio 2010\Templates\ItemTemplates
For Visual Studio 2019:
Extensions > Manage extensions > Installed > Uninstall
Worke for VS 2012 and 2015 :
In Visual Studio: go to Tools > Extensions and Updates and then uninstall or disable the template.
worke in VS 2019 :
1- In VS2019, custom templates can be removed by deleting the template folder from %USERPROFILE%\AppData\Roaming\Microsoft\VisualStudio{VSVersion}\ProjectTemplatesCache. Look for a {VSVersion} that begins with "16".
https://i.stack.imgur.com/V6SQ5.png
2- Delete What You Want From Templates Folder in {C:\Users\USERName\Documents\Visual Studio 2019\My Exported Templates}
Notes :
{ProjectTemplatesCache} Or {ItemTemplatesCache}
https://i.stack.imgur.com/9BM9p.png
For Visual Studio Express 2010 you should delete all folders under
%USERPROFILE%\AppData\Local\Microsoft\VCSExpress\10.0\Extensions
For Visual Studio 2013 Community, you have to delete {program folder}\Common7\IDE\ItemTemplatesCache\cache.bin after deleting all the unwanted files as described above. Afterwards VS will rebuild the templates listing in the New Project... dialog.
You could also try this:
dotnet new --uninstall <PATH|NUGET_ID>
It works for me in VS 2019 and VS 2022 to uninstall the Avalonia templates.
Description
The dotnet new --uninstall command uninstalls a template package at the PATH or NUGET_ID provided. When the <PATH|NUGET_ID> value isn't specified, all currently installed template packages and their associated templates are displayed. When specifying NUGET_ID, don't include the version number.
Examples
Uninstall the Avalonia templates
dotnet new --uninstall Avalonia.Templates
From MicrosoftDocs
If the template was installed by double clicking a VSIX file, it is considered an extension and can be uninstalled using the technique described by Hamid Behnam above. Otherwise, it can be deleted from one of the template directories mentioned above.
It looks like in each case we use different recipe. Unfortunately, commands line and VS menu command listed in this thread did not work in my case, which is MS VS 2019 Community Edition on Win7 x64:
First, close VS, remove unwanted *.zip files from all following folders, as well as hidden cache.bin file from the last \ProjectTemplatesCache folder (it will be restored at VS startup), then restart VS. Here are those 3 folders:
{Documents}\Visual Studio 2019\My Exported Templates
{Documents}\Visual Studio 2019\Templates\ProjectTemplates
{User}\AppData\Roaming\Microsoft\VisualStudio{Number}\ProjectTemplatesCache

Resources