This is possible in the C++ IDE, not the C# IDE. I'd guess it was omitted intentionally because C# has better ways to configure a program. Environment variables are awkward since they require an installer that tinkers with the user's system environment when the app is deployed. That's brittle, another installer can easily destroy that and they often do.
The C# way is to use an application setting. Project + Properties, Settings tab.
A possible alternative is to use a command line argument. You'll get it in your Main() method, you specify a value in the Project + Properties, Debug tab.
You can still get what you want with a trick that takes using the C++ IDE to start your program:
- Add a new project to your solution and select the Visual C++, General, Makefile project template.
- Click Finish right away, the wizard asks too many questions.
- Right-click the added project, Properties, select the NMake node.
- Edit the "Build Command Line" setting, and set it to "echo Done".
- Edit the "Output" setting, set it to the full path of your C# executable.
- Select the Debugging node, change the Debugger type to Managed Only.
- And you'll see the one below that, what you want, edit the "Environment" setting.
- Right-click the project again, pick "Set as Startup Project".