LIB library /EXTRACT:member /OUT:objectfile - visual-studio

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

Related

Visual Studio: missing Shortcut: "Visual Studio Command Prompt"

Because the VS 2015 Installer was crashing all the time, I had to use the silent installation. Now I don't have the "Visual Studio Command Prompt" Shortcut in Start menu. Can I find it somewhere else?
I had to create the shortcuts manually as well, but they all follow the same pattern so no biggie:
%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"" x86
Don't forget to change the execution path to: "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\"
Replace the last bit (x86) with the tool you want to use:
x86
amd64
arm
x86_arm
x86_amd64
amd64_x86
amd64_arm
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 and have a shortcut for the same.

Access Visual Studio Developer Command Prompt from regular Command Prompt

This related question shows how to build and run a Visual Studio solution from Visual Studio Developer Command Prompt. My question is, is it possible to build and run a Visual Studio solution directly from the regular Windows Command Prompt (cmd.exe)?
Finally, I found the answer.
Access VS Developer Command Prompt from regular command prompt.
C:\Users\Hwathanie>cmd.exe /k ""C:\Program Files (x86)\Microsoft Visual
Studio 12.0\VC\vcvarsall.bat"" x86
Build the solution.
C:\Users\Hwathanie>msbuild "C:\Users\Hwathanie\Documents\Visual
Studio 2013\Projects\MyProject\MyProject.sln" /p:Configuration=Debug
Run the exe file created.
C:\Users\Hwathanie>"C:\Users\Hwathanie\Documents\Visual Studio 2
013\Projects\MyProject\bin\Debug\MyProject.exe"

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.

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

Resources