Setting environment variable for build based on configuration

How do I set environment variable for build for each configuration?
I would like to use local project instead of nuget package for some configurations. In csproj file I have

<ItemGroup Condition="'$(LOCAL_API)' != ''">
<PackageReference Include="Cord" Version="0.0.24" />
<ItemGroup Condition="'$(LOCAL_API)' == ''">
<ProjectReference Include="../../api/API/Cord.csproj" />

But when I set env variable in configuration it's runtime only and it does not apply for build process.

1 comment
Comment actions Permalink

Hello Rene,

To set a variable for the solution you may want to pass it right to the MSBuild in Preferences > Build, Execution, Deployment > Toolset and Build > MSBuild Global Properties > Edit and then + sign. Then fill in name and value of the variable.

Please inform me if that solution help you.


Please sign in to leave a comment.