1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 06:37:46 +00:00
nu_scripts/modules/virtual_environments/nu_msvs
S. Abid Hashimi 3c32fbfade
Prepend INCLUDE env, instead of override (#1127)
This small fix prepends the `INCLUDE` environment variable instead of
overriding it.

This is important if one has already added paths to this environment,
for example, in cases where one needs a common set of codebase that gets
included in all C/C++ projects (such as utility functions and such).
2025-06-02 19:10:20 -05:00
..
nu_msvs.nu Prepend INCLUDE env, instead of override (#1127) 2025-06-02 19:10:20 -05:00
README.md resolve several issues in nu_conda and nu_msvs (#872) 2024-06-07 07:36:00 -05:00

MSVS Module for Nushell

A module for Using Microsoft Visual Studio (MSVS) command line tools from Nushell.

Prerequisites

Installation

Put nu_msvs.nu into the module folder of your nushell configuration workspace.

Usage

use nu_msvs.nu
nu_msvs activate  # Use 'nu_msvs activate --help' to see all available options
nu_msvs deactivate

How It Works

MSVS provides scripts (such as vsdevcmd.bat and vsvarsall.bat) for developers to use its command line tools (such as cl.exe) in Command Prompt and Powershell, but these scripts are not available for nushell. One method to use MSVS command line tools in nushell was described in nushell/nushell#5803, which requires launching nushell within an Command Prompt/Powershell instance. However, running vsdevcmd.bat or launching Powershell is quite slow. Therefore, nu_msvs.nu is introduced and works similar to a virtual environment.

When activating the MSVS environment (take MSVC tools for example):

  1. Necessary path are added to PATH/Path to allow command line tools (e.g. cl.exe) to be run in nushell.
  2. An environment variable INCLUDE is defined and consists of Win32 header directories, which will be used by cl.exe.
  3. An environment variable LIB is defined and consists of Win32 library directories, which will be used by link.exe.

Supported Tools

  • MSVC
  • ...