Where can i set this variable in managed console application? in native console application I put it in enviroment
Setting environment variables used for file assignments can be done in a number of locations. You can set them at the system level using Control Panel or they can be set in a .bat file prior to opening Visual Studio. Within the IDE you can set then on the property page on the Application tab using the environment button but this will only set them for use when running within the IDE. A better location to set these would be in an application.config file that is stored in the same folder as the executable. This way it will be picked up when running your application inside the IDE and outside the IDE (in production).
Right-click your project name and select Add-->New Item and then select Application.configuration file to add one to your project. You can then add environment variables to this file by right-clicking on the app.config and selecting Edit and using the environment tab.
This can be used in managed code as well as native code projects although they work a little differently. An app.config is only picked up for your main application so it should be set in your main programs project.
An alternative to this approach is to use the MFEXTMAP.DAT file which associates internal files to external file names. This is documented in the file handling section " "mfextmap" ">here: