riverrun / argon2_elixir

Elixir wrapper for the Argon2 password hashing algorithm
Apache License 2.0
229 stars 34 forks source link

Cannot find nmake in windows with the new erlang 21.0 #20

Closed vjorjo closed 6 years ago

vjorjo commented 6 years ago

windows 10, 64 I installed the new otp_win64_21.0 and I cannot compile argon2_elixir. It is unable to find nmake, which is in the path:

D:\AppsDev\Elixir\elm_chess>where nmake
f:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\Hostx64\x64\nmake.exe
f:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\Hostx86\x86\nmake.exe

D:\AppsDev\Elixir\elm_chess>mix deps.compile
===> Compiling ranch
src/ranch_ssl.erl:128: Warning: ssl:ssl_accept/2: deprecated; use ssl:handshake/2 instead

==> poolboy (compile)
warning: String.strip/1 is deprecated, use String.trim/1
  d:/AppsDev/Elixir/elm_chess/deps/poison/mix.exs:4

==> argon2_elixir
could not compile dependency :argon2_elixir, "mix compile" failed. You can recompile this dependency with "mix deps.compile argon2_elixir", update it with "mix deps.update argon2_elixir" or clean it with "mix deps.clean argon2_elixir"
==> elm_chess
** (Mix) "nmake" not found in the path. If you have set the MAKE environment variable,
please make sure it is correct.
D:\AppsDev\Elixir\elm_chess>

I had to go back to otp_win64_20.3 and then everything was compiled normally.

riverrun commented 6 years ago

So it works with otp 20, but not otp 21?

vjorjo commented 6 years ago

Yes, that's right!

riverrun commented 6 years ago

Do you have multiple versions of Erlang installed? In the iex shell, what is the output of :erlang.system_info(:version)?

vjorjo commented 6 years ago

Now I have only version 20.3. The output is '9.3'. But I can install 21 if you want me to test anything.

riverrun commented 6 years ago

If you have OTP 21 installed, the output should be "10.0". Could you check that for me?

vjorjo commented 6 years ago

But I know what I have installed. I now have OTP 20.3 installed and the output is 9.3. However yesterday I had uninstalled OTP20.3 and I had installed OTP 21. Then I tried to compile a project I'm currently working on, but it failed with the message I wrote above (about not finding nmake). Then I uninstalled OTP21 and installed again OTP20.3 and the compilation succeeded. I actually made the above procedure (uninstalled 20.3, installed 21, failed compilation again, uninstalled 21, installed 20.3, compilation succeeded again) one more time with the same results. Now I've installed 20.3 so that I can work on my project and I'd like to move to OTP21 but this issue of the compilation of argon2_elixir keeps me to 20.3.

vjorjo commented 6 years ago

I installed again OTP 21 and I run the command you asked me, just before attempting the compilation:

D:\AppsDev\Elixir>iex
Interactive Elixir (1.6.6) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :erlang.system_info(:version)
'10.0'
iex(2)> :init.stop()
:ok
iex(3)> Terminate batch job (Y/N)? Y

D:\AppsDev\Elixir>cd elm_chess

D:\AppsDev\Elixir\elm_chess>mix deps.compile argon2_elixir
==> argon2_elixir
could not compile dependency :argon2_elixir, "mix compile" failed. You can recompile this dependency with "mix deps.compile argon2_elixir", update it with "mix deps.update argon2_elixir" or clean it with "mix deps.clean argon2_elixir"
==> elm_chess
** (Mix) "nmake" not found in the path. If you have set the MAKE environment variable,
please make sure it is correct.

D:\AppsDev\Elixir\elm_chess>where nmake
f:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\Hostx64\x64\nmake.exe
f:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\Hostx86\x86\nmake.exe

D:\AppsDev\Elixir\elm_chess>
riverrun commented 6 years ago

What is the output of System.find_executable("nmake")?

vjorjo commented 6 years ago

OPT 21:

D:\AppsDev\Elixir>iex
Interactive Elixir (1.6.6) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> System.find_executable("nmake")
nil
iex(2)>
riverrun commented 6 years ago

That's the problem.

vjorjo commented 6 years ago

I just tried with OTP 20.3:

D:\AppsDev\Elixir>iex
Interactive Elixir (1.6.6) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> System.find_executable("nmake.exe")
"f:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/HostX64/x64/nmake.exe"
iex(2)>
vjorjo commented 6 years ago

This means it's a problem of the new erlang release?

riverrun commented 6 years ago

It's talked about here.

It seems like it has been fixed, but you need to wait for the next release.

vjorjo commented 6 years ago

ok, thank you!

riverrun commented 6 years ago

Let's keep this issue open, so other people can see it, and then when the next release comes out, we can close it then.

vjorjo commented 6 years ago

ok

vjorjo commented 6 years ago

This was resolved with the new release 21.01 of OTP for windows.

riverrun commented 6 years ago

Great! Thanks for letting me know.

d-vyd commented 5 years ago

I see this error even on 21.0.1.

could not compile dependency :bcrypt_elixir, "mix compile" failed. You can recompile this dependency with "mix deps.compile bcrypt_elixir", update it with "mix deps.update bcrypt_elixir" or clean it with "mix deps.clean bcrypt_elixir" ** (Mix) "nmake" not found in the path. If you have set the MAKE environment variable, please make sure it is correct.

riverrun commented 5 years ago

@d-vyd in an iex shell, could you run System.find_executable("nmake") and let me know what the output is?

d-vyd commented 5 years ago

The output is "nil".

Someone elsewhere suggested installing a unix version running within windows linux subsystem. That is not ideal, but it works.

vjorjo commented 5 years ago

@d-vyd did you follow this procedure: https://dcodin.wordpress.com/2015/12/31/compiling-comeonin-for-phoenix-on-windows/

riverrun commented 5 years ago

And is nmake installed?

d-vyd commented 5 years ago

Is it part of Microsoft's c++ binaries? Where would it be located?

On Dec 10, 2018 9:32 AM, David Whitlock notifications@github.com wrote:

And is nmake installed?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/riverrun/argon2_elixir/issues/20#issuecomment-445715338, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AZLLF4PTW2yU62VJMzY_eSB32GdCgR9Sks5u3g4XgaJpZM4U0xvB.

riverrun commented 5 years ago

Try looking for nmake in the Program Files (x86)/Microsoft Visual Studio folder.

If you do not have Visual Studio installed, let me know how you installed the C++ binaries.

d-vyd commented 5 years ago

I have Visual Studio 2017 and nmake.exe is located here: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64

I have Visual Studio 14 and nmake.exe is located here: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64

I also have this directory which not not have nmake.exe and seems to be just different links to command prompts: C:\Program Files (x86)\Microsoft Visual C++ Build Tools

So, I need to set an environment variable or update my path? If so, how?


From: David Whitlock notifications@github.com Sent: Monday, December 10, 2018 8:49 AM To: riverrun/argon2_elixir Cc: d-vyd; Mention Subject: Re: [riverrun/argon2_elixir] Cannot find nmake in windows with the new erlang 21.0 (#20)

Try looking for nmake in the Program Files (x86)/Microsoft Visual Studio folder.

If you do not have Visual Studio installed, let me know how you installed the C++ binaries.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/riverrun/argon2_elixir/issues/20#issuecomment-445736384, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AZLLF4rN1SV2xWbWS1a6e3894ywxUbnNks5u3iAKgaJpZM4U0xvB.

d-vyd commented 5 years ago

I added nmake to my path and received a different error. I do not know anything about the file that is supposedly missing "stdint.h". I tried to install using "Choco" as the error message suggested and was told that the package was not available. I'd appreciate any advice anyone has.

D:\projects\Programming\Elixir\ex_venture-master>mix compile ==> bcrypt_elixir

Microsoft (R) Program Maintenance Utility Version 14.16.27024.1 Copyright (C) Microsoft Corporation. All rights reserved.

    del /Q /F priv

Could Not Find d:\projects\Programming\Elixir\ex_venture-master\deps\bcrypt_elixir\priv erl -eval "io:format(\"~s~n\", [lists:concat([\"ERTS_INCLUDE_PATH=\", code:root_dir(), \"/erts-\", erlang:system_info(version), \"/include\"])])" -s init stop -noshell > Makefile.auto.win nmake / /F Makefile.win priv\bcrypt_nif.dll

Microsoft (R) Program Maintenance Utility Version 14.16.27024.1 Copyright (C) Microsoft Corporation. All rights reserved.

    if NOT EXIST "priv" mkdir "priv"
    cl /O2 /EHsc /I"c_src" /I"c:/Program Files/erl10.0.1/erts-10.0.1/include" /LD /MD /Fepriv\bcrypt_nif.dll  c_src\bcrypt_nif.c c_src\blowfish.c

Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27024.1 for x64 Copyright (C) Microsoft Corporation. All rights reserved.

bcrypt_nif.c c_src\bcrypt_nif.c(52): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory blowfish.c d:\projects\programming\elixir\ex_venture-master\deps\bcrypt_elixir\c_src\blf.h(37): fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory Generating Code... NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\cl.EXE"' : return code '0x2' Stop. NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\nmake.EXE"' : return code '0x2' Stop. could not compile dependency :bcrypt_elixir, "mix compile" failed. You can recompile this dependency with "mix deps.compile bcrypt_elixir", update it with "mix deps.update bcrypt_elixir" or clean it with "mix deps.clean bcrypt_elixir" ==> ex_venture ** (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.

D:\projects\Programming\Elixir\ex_venture-master>choco install VisuallCppBuildTools Chocolatey v0.10.11 Installing the following packages: VisuallCppBuildTools By installing you accept licenses for the packages. VisuallCppBuildTools not installed. The package was not found with the source(s) listed. Source(s): 'https://chocolatey.org/api/v2/' NOTE: When you specify explicit sources, it overrides default sources. If the package version is a prerelease and you didn't specify --pre, the package may not be found. Please see https://chocolatey.org/docs/troubleshooting for more assistance.

Chocolatey installed 0/1 packages. 1 packages failed. See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures


From: Da'ud Vyd Sent: Monday, December 10, 2018 9:09 AM To: riverrun/argon2_elixir Subject: Re: [riverrun/argon2_elixir] Cannot find nmake in windows with the new erlang 21.0 (#20)

I have Visual Studio 2017 and nmake.exe is located here: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64

I have Visual Studio 14 and nmake.exe is located here: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64

I also have this directory which not not have nmake.exe and seems to be just different links to command prompts: C:\Program Files (x86)\Microsoft Visual C++ Build Tools

So, I need to set an environment variable or update my path? If so, how?


From: David Whitlock notifications@github.com Sent: Monday, December 10, 2018 8:49 AM To: riverrun/argon2_elixir Cc: d-vyd; Mention Subject: Re: [riverrun/argon2_elixir] Cannot find nmake in windows with the new erlang 21.0 (#20)

Try looking for nmake in the Program Files (x86)/Microsoft Visual Studio folder.

If you do not have Visual Studio installed, let me know how you installed the C++ binaries.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/riverrun/argon2_elixir/issues/20#issuecomment-445736384, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AZLLF4rN1SV2xWbWS1a6e3894ywxUbnNks5u3iAKgaJpZM4U0xvB.

d-vyd commented 5 years ago

I'm going to try to install Erlang + Elixir + ExVenture on a Ubuntu VirtualBox instead of continuing to struggle with the Windows install. Thank you for your help.


From: Da'ud Vyd Sent: Monday, December 10, 2018 6:44 PM To: riverrun/argon2_elixir Subject: Re: [riverrun/argon2_elixir] Cannot find nmake in windows with the new erlang 21.0 (#20)

I added nmake to my path and received a different error. I do not know anything about the file that is supposedly missing "stdint.h". I tried to install using "Choco" as the error message suggested and was told that the package was not available. I'd appreciate any advice anyone has.

D:\projects\Programming\Elixir\ex_venture-master>mix compile ==> bcrypt_elixir

Microsoft (R) Program Maintenance Utility Version 14.16.27024.1 Copyright (C) Microsoft Corporation. All rights reserved.

    del /Q /F priv

Could Not Find d:\projects\Programming\Elixir\ex_venture-master\deps\bcrypt_elixir\priv erl -eval "io:format(\"~s~n\", [lists:concat([\"ERTS_INCLUDE_PATH=\", code:root_dir(), \"/erts-\", erlang:system_info(version), \"/include\"])])" -s init stop -noshell > Makefile.auto.win nmake / /F Makefile.win priv\bcrypt_nif.dll

Microsoft (R) Program Maintenance Utility Version 14.16.27024.1 Copyright (C) Microsoft Corporation. All rights reserved.

    if NOT EXIST "priv" mkdir "priv"
    cl /O2 /EHsc /I"c_src" /I"c:/Program Files/erl10.0.1/erts-10.0.1/include" /LD /MD /Fepriv\bcrypt_nif.dll  c_src\bcrypt_nif.c c_src\blowfish.c

Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27024.1 for x64 Copyright (C) Microsoft Corporation. All rights reserved.

bcrypt_nif.c c_src\bcrypt_nif.c(52): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory blowfish.c d:\projects\programming\elixir\ex_venture-master\deps\bcrypt_elixir\c_src\blf.h(37): fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory Generating Code... NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\cl.EXE"' : return code '0x2' Stop. NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\nmake.EXE"' : return code '0x2' Stop. could not compile dependency :bcrypt_elixir, "mix compile" failed. You can recompile this dependency with "mix deps.compile bcrypt_elixir", update it with "mix deps.update bcrypt_elixir" or clean it with "mix deps.clean bcrypt_elixir" ==> ex_venture ** (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.

D:\projects\Programming\Elixir\ex_venture-master>choco install VisuallCppBuildTools Chocolatey v0.10.11 Installing the following packages: VisuallCppBuildTools By installing you accept licenses for the packages. VisuallCppBuildTools not installed. The package was not found with the source(s) listed. Source(s): 'https://chocolatey.org/api/v2/' NOTE: When you specify explicit sources, it overrides default sources. If the package version is a prerelease and you didn't specify --pre, the package may not be found. Please see https://chocolatey.org/docs/troubleshooting for more assistance.

Chocolatey installed 0/1 packages. 1 packages failed. See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures


From: Da'ud Vyd Sent: Monday, December 10, 2018 9:09 AM To: riverrun/argon2_elixir Subject: Re: [riverrun/argon2_elixir] Cannot find nmake in windows with the new erlang 21.0 (#20)

I have Visual Studio 2017 and nmake.exe is located here: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64

I have Visual Studio 14 and nmake.exe is located here: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64

I also have this directory which not not have nmake.exe and seems to be just different links to command prompts: C:\Program Files (x86)\Microsoft Visual C++ Build Tools

So, I need to set an environment variable or update my path? If so, how?


From: David Whitlock notifications@github.com Sent: Monday, December 10, 2018 8:49 AM To: riverrun/argon2_elixir Cc: d-vyd; Mention Subject: Re: [riverrun/argon2_elixir] Cannot find nmake in windows with the new erlang 21.0 (#20)

Try looking for nmake in the Program Files (x86)/Microsoft Visual Studio folder.

If you do not have Visual Studio installed, let me know how you installed the C++ binaries.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/riverrun/argon2_elixir/issues/20#issuecomment-445736384, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AZLLF4rN1SV2xWbWS1a6e3894ywxUbnNks5u3iAKgaJpZM4U0xvB.

shini-tm commented 5 years ago

I'm on erlang 21.3 and I'm still getting this error on windows. Adding "Comeonin" as a dependency works fine but adding "argon2_elixir" gives me this error when compiling:

iex -S mix phx.server ==> elixir_make Compiling 1 file (.ex) Generated elixir_make app ==> argon2_elixir

Microsoft (R) Program Maintenance Utility Version 14.00.24210.0 Copyright (C) Microsoft Corporation. All rights reserved.

makefile(34) : fatal error U1000: syntax error : ')' missing in macro invocation Stop. could not compile dependency :argon2_elixir, "mix compile" failed. You can recompile this dependency with "mix deps.compile argon2_elixir", update it with "mix deps.update argon2_elixir" or clean it with "mix deps.clean argon2_elixir" ==> chatter ** (Mix) Could not compile with "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\nmake.exe" (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.

Before this, just like @d-vyd, i had to set my nmake path in the system environmental variables. I'd really prefer to stay on windows.

riverrun commented 5 years ago

Which version of argon2_elixir are you using?

shini-tm commented 5 years ago

Argon2_elixir 2.0.2

defp deps do
    [
     ...
      {:comeonin, "~> 5.1.1"},
      {:argon2_elixir, "~> 2.0"}
    ]
  end
shini-tm commented 5 years ago

I've tried replacing argon2_elixir with bcrypt_elixir and the error is the same except for this line: makefile(3) : fatal error U1000: syntax error : ')' missing in macro invocation whereas argon2_elixir gives: makefile(34) : fatal error U1000: syntax error : ')' missing in macro invocation

shini-tm commented 5 years ago

I think it's definitely something to do with Windows. I've opted to use Pbkdf2 instead of argon2 and bcrypt as this seems to be the only working dependancy

riverrun commented 5 years ago

First of all, you do not need to add the comeonin dependency - comeonin is now a dependency of argon2_elixir.

I noticed that there is this question on SO. Did you try adding nmake to the PATH, and how did that work?

egeersoz commented 5 years ago

Running into the same issue.

riverrun commented 5 years ago

@egeersoz is it the same error - ')' missing in macro invocation?

tuomohopia commented 4 years ago

I keep hitting

==> argon2_elixir
could not compile dependency :argon2_elixir, "mix compile" failed. You can recompile this dependency with "mix deps.compile argon2_elixir", update it with "mix deps.update argon2_elixir" or clean it with "mix deps.clean argon2_elixir"
==> my_project
** (Mix) "nmake" not found in the path. If you have set the MAKE environment variable,
please make sure it is correct.

WIN10 & {:argon2_elixir, "~> 2.0"}. I installed Visual Studio 2019 and put nmake's path in Path env variable.

riverrun commented 4 years ago

@tuomohopia try asking about this on Stack Overflow or Elixirforum - there you might find users of Windows / Visual Studio 2019 who can help you more than I can.

If any changes need to be made to this repository (in the code or documentation), please let me know.

AronTurbo commented 4 years ago

Microsoft Visual Studio 8 i could not find nmake. how do i add

AronTurbo commented 4 years ago

==> bcrypt_elixir could not compile dependency :bcrypt_elixir, "mix compile" failed. You can recompile this dependency with "mix deps.compile bcrypt_elixir", update it with "mix deps.update bcrypt_elixir" or clean it with "mix deps.clean bcrypt_elixir" ==> tc_api ** (Mix) "nmake" not found in the path. If you have set the MAKE environment variable, please make sure it is correct.

riverrun commented 4 years ago

@AronTurbo first, make sure that you have the C++ developer tools installed.

I think that you will get more help if you ask a question about this on stackoverflow or elixirforum. That way, you might get help from Windows users.

If that doesn't work out, as a last resort, you can always install pbkdf2_elixir, which is written in Elixir and is therefore easy to install.

danieltareke commented 3 years ago

I had the same error ** (Mix) "nmake" not found in the path. If you have set the MAKE environment variable, I am using argon2_elixir The problem seems it could not find nmake even if it exists in the system After Googling I have switched from the normal cmd to developer cmd and it worked for me

image and generated the secret key image

benvds commented 2 years ago

I've had some trouble with this as well because I wanted to use powershell. I've solved this way:

  1. Install Microsoft C++ Build Tools intstruction from Exqlite.
  2. Add the following to the powershell profile script:
cmd.exe /c "call `"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat`" && set > %temp%\vcvars.txt"

Get-Content "$env:temp\vcvars.txt" | Foreach-Object {
  if ($_ -match "^(.*?)=(.*)$") {
    Set-Content "env:\$($matches[1])" $matches[2]
  }
}
benvds commented 2 years ago

Ok I got things working with Visual Studio Code LS as well by adding the following to the settings.json:

{
  "terminal.integrated.profiles.windows": {
    "PowerShell": {
      "source": "PowerShell",
      "icon": "terminal-powershell"
    },
    "Command Prompt": {
      "path": [
        "${env:windir}\\Sysnative\\cmd.exe",
        "${env:windir}\\System32\\cmd.exe"
      ],
      "args": ["/k", "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat"],
      "icon": "terminal-cmd"
    },
    "Git Bash": {
      "source": "Git Bash"
    }
  },
  "terminal.integrated.defaultProfile.windows": "Command Prompt",
}