I'd like to automatically update my Visual Studio 2017 installation from a script (running this script at session login).
vs_installer shows a bunch of command line arguments (using /?). So I tried :
& "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" update --passive --norestart
However, nothing happens. I see the process in the task manager for a few seconds, but the product is not updated.
How to update my VS installation ?
Is is possible to handle the installer update ?
PS: if possible, I'd to have a passive update, not an invisible update. I'd prefer seeing the product being updated to avoid launching a new instance while the update is in progress.
I found partially the answer. I have to specify the install path of visual studio to let the installer knows what to update:
& "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" update --passive --norestart --installpath "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise" (assuming default path).
I still have to look for updates of the installer itself, but since I've the latest version, I've to wait for a new release.
[Edit 04/10/2019] The update process is similar with VS 2019 (at least from 16.0 to 16.0.1). I can update both version using :
Start-Process -Wait -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList "update --passive --norestart --installpath ""C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise"""
Start-Process -Wait -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList "update --passive --norestart --installpath ""C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise"""
I use Start-Process with -Wait to avoid returning control before the end of the update.
Related
I'm compiling a solution and have made the following change in the .vcxproj file <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> from
<PlatformToolset>v142</PlatformToolset>
I have VS 2019 professional and the Windows 10 1903 wdk and windows 10 sdk 19041 installed and I keep getting the following error when I try to compile the solution file, Any pointers on what am I doing wrong here are greatly appreciated!
error MSB8020: The build tools for WindowsApplicationForDrivers10.0 (Platform Toolset = 'Windows ApplicationForDrivers10.0') cannot be found. To build using the WindowsApplicationForDrivers10.0 build tools, please install WindowsApplicationForDrivers10.0 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution".
The command to compile my solution file is as follows on the windows containers
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\Tools\VsDevCmd.bat" && msbuild myproject.sln /m /p:Platform=x64 /p:Configuration="Release"
I had to install the wdk.vsix (wdk extension for Visual studio) manually after installing the WDK into the VS installation location. Following are the powershell commands to do this:
Copy-Item ""${Env:ProgramFiles(x86)}\Windows Kits\10\Vsix\WDK.vsix"" 'C:\wdkvsix.zip'
Expand-Archive 'C:\wdkvsix.zip' -DestinationPath 'C:\WdkVsix'
Copy-Item 'C:\WdkVsix$VCTargets\Platforms*' -Destination 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Platforms' -Recurse -Force
I am trying to use devenv.exe to upgrade Visual Studio 2013 solution files through the command line.
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.exe" TimeReportingDataMart.sln /Upgrade
But there is no output, and the solution does not upgrade. Is devenv not the correct tool for this? Or am I just missing something completely?
The problem was that I was calling devenv.exe when I should have been calling devenv.
Calling,
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.exe" TimeReportingDataMart.sln /Upgrade fails.
But calling
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv" TimeReportingDataMart.sln /Upgrade gives me output.
It gives:
Copyright (C) Microsoft Corp. All rights reserved.
Information:
This project/solution does not require migration. It will open without modification.
Which doesn't help me, but at least I got the command to run..
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.
I am using visual studio 2010
I need a script that launches the visual studio console and executes some commands
More specifically something like this:
%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86
msbuild smothing
cd somewhere
etc...
However after executing the first line and entering the visual studio mode the script stops
How can I make it run msbuild and everything else in one go?
I needed to change the top line with this:
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
I want to create a batch file for Visual Studio 2008 x64 Cross Tools Command Prompt to do something continuesly in my PC, here is the senario.
svn update
delete some files
MSBuild MySolutiuon.sln
delete some files
xcopy somefiles
MSBuild AutomateBuildConfiguration.xml /p:Configuration=Release
xcopy some files
delete somefiles
xcopy some files
create a Zip file if it is possible // it is not neccessary
I can do most of it with simple Command Prompt and MSBuild parts with Visual Studio Command Prompt, but as these two prompt are different I cannot complete my senario.
I have tested all command and work great for me, Give me a solution if you know what should I do.
I checked this and didn't underestand anything
Thank you in advance
Make the first line of your batch file set up the VS environment:
call "C:\Program Files\Microsoft Visual Studio 2008\VC\vcvarsall.bat" x86_amd64
svn update
delete some files
MSBuild MySolutiuon.sln
... more commands ...
x86_amd64 is the argument used for x64 Cross Tools Command Prompt.
Once vcvarsall.bat has run, msbuild will be available in the path for the rest of the commands in your batch file.
Alternatively, if you aren't using Visual C++, you might prefer to set up the environment with this line (instead of the call to vcvarsall.bat):
For VS 2008:
call "%vs90comntools%vsvars32.bat"
For VS 2010:
call "%vs100comntools%vsvars32.bat"
For VS 2012:
call "%vs110comntools%vsvars32.bat"
For VS 2013:
call "%vs120comntools%vsvars32.bat"
For VS 2015:
call "%vs140comntools%vsvars32.bat"
For VS 2017:
Batch is now called vc not vs.
call "%vs140comntools%\..\..\VC\Auxiliary\Build\vcvars32.bat"
or better
call "%vs140comntools%\VsDevCmd.bat"
For Visual Studio 2015:
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
For Visual Studio 2013:
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86_amd64
For Visual Studio 2010, this is working great:
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
For Visual Studio 2019 :
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
And for Visual Studio 2012:
call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86_amd64
I wrote a bat file using the following steps and it worked.
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86_amd64
echo call complete
pause
cd C:\tfs.sbdinc.com
tf get $/MAC_MBA/CoreApplicationAndReports/Main/Application/Solution /recursive
echo get complete
pause
cd C:\tfs\CoreApplicationAndReports\Main\Application\Solution
msbuild
echo build complete
pause
devenv mba.sln
echo ide launch complete
pause
Try below batch file to run the MS test/Nunit test for C# tests.
#echo off
echo Run the CMD(Command Prompt) Program.
echo.
pause
cls
echo Target Framwork
CD C:\Windows\Microsoft.NET\Framework64\v4.0.30319
echo 'Project Path'
msbuild "C:\Git\ElementsCloud.Tests\Source\ElementsCloud.Tests.sln"/p:configuration=debug
pause
echo 'Project Dll path' and Execute tests
cd C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow
vstest.console.exe "C:\Git\ElementsCloud.Tests\Source\Selenium.Tests\bin\Debug\net471\Selenium.Tests.dll" /Tests:Test1,Test2,Test3
echo.
PAUSE
EXIT