Turning off WSL bash build from Visual Studio 2015

I recently started using the Windows Subsystem for Linux (WSL) to see if my Linux Makefile and non-eabi-gcc-based microcontroller project will build โ€œnativelyโ€ on Windows. To my surprise, the Linux toolchain and development tools were installed and worked great the first time, without any changes to the Makefile.

So, I thought to try all my code editing in Visual Studio using the IDE functions, doing the actual build in Linux and bash provided in WSL.

Unfortunately, when specifying "Build Command Line" in the NMake options for my Visual Studio project, placing "C:\Windows\System32\bash.exe build.sh" does not work because:

'C:\Windows\System32\bash.exe' is not recognized as an internal or external command, operable program or batch file.

This is strange for me because I indicated the full path and could not find the WSL bash executable, and also try to add it as an โ€œexternal toolโ€, it seems to not work, because the executable does not work, t is displayed in the selection window. despite the ability to see other executables in the same directory.

Some opinion on the topic: If Microsoft can get Visual Studio and WSL to work together, I would rather switch from my Ubuntu virtual machine installation to the WSL-based development environment.

+5
source share
1 answer

Here's how to do it:

Nmake is not a 64-bit application, so when it tries to use the Windows and system32 utilities, WoW64 tricks it elsewhere.

The way to start from a 32-bit application:

%windir%\sysnative\bash.exe

However, your command is also incorrect. You will need to do this as follows:

%windir%\sysnative\bash.exe -c "sh build.sh"

or maybe

%windir%\sysnative\bash.exe -c "./build.sh"

if DriveFS permissions allow execution.

otherwise, it will try to execute build.sh as a command in your linux $ PATH user.

Source: https://github.com/Microsoft/BashOnWindows/issues/870

0
source

All Articles