locked
How to set environment varuable for C# ? RRS feed

  • Question

  • How can i set environment variable for C# compiler(if possible plz tell for vb.net also) to compile my source code from cmd ?I remember i first set environment variable for Java,but here i am not getting help.
    Thursday, October 14, 2010 5:05 PM

Answers

  • How can i set environment variable for C# compiler(if possible plz tell for vb.net also) to compile my source code from cmd ?I remember i first set environment variable for Java,but here i am not getting help.

    If you want to have the environment for a command line setup for the compiler, run:

     

    Start->Programs->Visual Studio 2010 (or your version)->Tools ->Visual Studio Command Prompt

     

    This will start a command prompt with a proper environment for C# or VB.NET compilation.


    Reed Copsey, Jr. - http://reedcopsey.com
    • Marked as answer by Bin-ze Zhao Tuesday, October 19, 2010 7:15 AM
    Thursday, October 14, 2010 6:19 PM

All replies

  • set <environment variable>=<value>
    
    Use the above command on the cmd window. Also see this link to set it through the VS IDE.
    akx++ Solutions

    Vote if helpful (or) Mark it Answered if answered your query.
    Thursday, October 14, 2010 5:26 PM
  • Environment.SetEnvironmentVariable("<env variable name>", "<value>");
    
    Also, If you have to set an environment variable through programming then use the Environment object as above.
    akx++ Solutions

    Vote if helpful (or) Mark it Answered if answered your query.
    Thursday, October 14, 2010 5:28 PM
  • How can i set environment variable for C# compiler(if possible plz tell for vb.net also) to compile my source code from cmd ?I remember i first set environment variable for Java,but here i am not getting help.

    If you want to have the environment for a command line setup for the compiler, run:

     

    Start->Programs->Visual Studio 2010 (or your version)->Tools ->Visual Studio Command Prompt

     

    This will start a command prompt with a proper environment for C# or VB.NET compilation.


    Reed Copsey, Jr. - http://reedcopsey.com
    • Marked as answer by Bin-ze Zhao Tuesday, October 19, 2010 7:15 AM
    Thursday, October 14, 2010 6:19 PM