Hakanai
Hakanai

Reputation: 12680

Trying to get nmake to work when installed via Chocolatey, what is the magic invocation?

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:

Upvotes: 2

Views: 1157

Answers (1)

Margaret Dax
Margaret Dax

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

Related Questions