Reputation: 12680
I'm trying to set up a dev environment for Elixir, and I figured I would try to use Chocolatey as the package manager because I had heard that some other people on other projects had some success with that thing.
So far I have these two packages installed:
choco install visualstudio2022community
choco install visualstudio2022buildtools
There is a large list of other packages available, and having not installed these may be related to the issue. It isn't entirely clear which ones I need.
C:\Windows\System32>choco search visualstudio2022
Chocolatey v2.1.0
visualstudio2022buildtools 117.6.3 [Approved]
visualstudio2022community 117.6.3 [Approved]
visualstudio2022enterprise 117.6.3 [Approved]
visualstudio2022professional 117.6.3 [Approved]
visualstudio2022-remotetools 17.0.33103.184 [Approved] Downloads cached for licensed users
visualstudio2022teamexplorer 117.6.3 [Approved]
visualstudio2022testagent 117.6.3 [Approved]
visualstudio2022testcontroller 117.6.3 [Approved]
visualstudio2022-workload-azure 1.0.0 [Approved]
visualstudio2022-workload-azurebuildtools 1.0.0 [Approved]
visualstudio2022-workload-data 1.0.0 [Approved]
visualstudio2022-workload-databuildtools 1.0.0 [Approved]
visualstudio2022-workload-datascience 1.0.1 [Approved]
visualstudio2022-workload-manageddesktop 1.0.1 [Approved]
visualstudio2022-workload-manageddesktopbuildtools 1.0.0 [Approved]
visualstudio2022-workload-managedgame 1.0.0 [Approved]
visualstudio2022-workload-nativecrossplat 1.0.0 [Approved]
visualstudio2022-workload-nativedesktop 1.0.0 [Approved]
visualstudio2022-workload-nativegame 1.0.0 [Approved]
visualstudio2022-workload-nativemobile 1.0.0 [Approved]
visualstudio2022-workload-netcrossplat 1.0.0 [Approved]
visualstudio2022-workload-netweb 1.0.0 [Approved]
visualstudio2022-workload-node 1.0.0 [Approved]
visualstudio2022-workload-nodebuildtools 1.0.0 [Approved]
visualstudio2022-workload-office 1.0.0 [Approved]
visualstudio2022-workload-officebuildtools 1.0.0 [Approved]
visualstudio2022-workload-python 1.0.0 [Approved]
visualstudio2022-workload-universal 1.0.0 [Approved]
visualstudio2022-workload-universalbuildtools 1.0.0 [Approved]
visualstudio2022-workload-vctools 1.0.0 [Approved]
visualstudio2022-workload-visualstudioextension 1.0.0 [Approved]
visualstudio2022-workload-visualstudioextensionbuildtools 1.0.0 [Approved]
visualstudio2022-workload-webbuildtools 1.0.0 [Approved]
visualstudio2022-workload-xamarinbuildtools 1.0.0 [Approved]
The installer didn't add the appropriate paths to the environment, which is the start of my troubles. So now I'm left trying to figure out what I have to add to get it to work.
So, if I go searching for nmake.exe
, there are four executables with that name on my system. But there are also many other directories with other tools so I haven't been able to figure out which ones I need to do the job.
The guide I'm following more or less said "just use WSL!", which sounds like a great way to get a web server working quickly but doesn't help me if I'm trying to build a client-side application.
What am I missing here? Happy to switch package managers if winget is more usable these days. I'm trying to avoid as much manual installation as possible so that the instructions I'm writing up can be as short as possible.
Tried so far:
Using the actual Visual Studio 2022 installer to do it manually instead of automating it. More or less resulted in the same confusing situation.
First of all, the command the error message is telling me to run doesn't work because it has been incorrectly quoted somehow:
C:\Users\tester\Projects\Elixir\my_app>cmd /K "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
'C:\Program' is not recognized as an internal or external command, operable program or batch file.
Manually adding one of the nmake
locations to my path, I get a different error message:
** (Mix) Could not compile with "nmake" (exit status: 2). One option is to install a recent version of Visual C++ Build Tools either manually or using Chocolatey -
choco install VisualCppBuildTools
.After installing Visual C++ Build Tools, look in the "Program Files (x86)" directory and search for "Microsoft Visual Studio". Note down the full path of the folder with the highest version number. Open the "run" command and type in the following command (make sure that the path and version number are correct):
cmd /K "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
This should open up a command prompt with the necessary environment variables set, and from which you will be able to run the "mix compile", "mix deps.compile", and "mix test" commands.
If I do try to install VisualStudioBuildTools
as suggested:
Exit code was '1603'. Exit code indicates the following: Generic MSI Error. This is a local environment error, not an issue with a package or the MSI itself - it could mean a pending reboot is necessary prior to install or something else (like the same version is already installed). Please see MSI log if available.)
Upvotes: 2
Views: 1157
Reputation: 57
Rather than install via Chocolatey, I followed this guide for installing Visual Studio 2022 in a Windows container and have the following in my Dockerfile
SHELL ["cmd", "/S", "/C"]
# Download the Build Tools bootstrapper.
RUN curl -SL --output vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe
# Install BuildTools
RUN (start /w vs_buildtools.exe --quiet --wait --norestart --nocache `
--installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" `
--add Microsoft.VisualStudio.Workload.NativeDesktop `
--add Microsoft.VisualStudio.Component.VC.14.36.17.6.x86.x64 `
--add Microsoft.VisualStudio.Component.VC.CMake.Project `
|| IF "%ERRORLEVEL%"=="3010" EXIT 0)
And I found the correct nmake here:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\bin\Hostx64\x64\nmake.exe
Referenced this related answer to find nmake for my install.
EDIT:
you can't run this unless it's in the path, best way to do that as far as I can tell is running vcvars64.bat and (if using powershell) extracting the set environment variables. Honestly a massive pain and I couldn't get what I was building with nmake to work (openssl) because it was having trouble finding c headers.
Upvotes: 1