'Environment Variable not found in csproj File

I tried using the Environment Variable APSNETCORE_ENVIRONMENT in my csproj file as a condition. But it doesn't seem to work.

The code:

<Target Name="NpmInstall" Inputs="$(SpaRoot)/package.json" Outputs="$(SpaRoot)/node_modules/.install-stamp" Condition="$(ASPNETCORE_ENVIRONMENT) != 'Development'">


Solution 1:[1]

NVM, appereantly msbuild only takes the system variables but not the ones defined in the debug tab. Solved it by adding my desired variable to the Global Environment Variables.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user3315635