How to configure NodeJS project to align with VS solution configuration?

Tamás Balogh 1 Reputation point
2022-07-31T12:12:10.617+00:00

Hi there!

I have a very simple question: how can I modify the Njsproj file to consider the currently active VS solution configuration? I have been doing research for hours but the closest thing I figured out can work is to add a C++ project built on Nan (https://github.com/nodejs/nan) to my solution that can leverage VS solution configuration. By adding this module, I could query my C++ extension whether this solution was built in 'Debug' or 'Release' mode (in C++ code itself using #if <Configuration> macros...). However, this feels like a massive overkill and surely there has to be a way to manually modify the .njsproj file to allow to consider?226475-expressapp2.txt -> I am attaching a baseline template NodeJS project generated by VS.

Why do I want to have this dependency? I want to be able to enforce certain methods only in Release mode: e.g. authentication. For now, I am going to be using the .env file to distinguish between my 'Debug' and 'Release' mode but I think the neatest would be for VS to leverage the solution configuration somehow!

I appreciate any insights!
Cheers,
Tamas Balogh

Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
935 questions
Visual Studio Setup
Visual Studio Setup
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
960 questions
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
35,843 questions
{count} votes