How do I build a dll from command line using C# express ?

I have C# express installed and would like to build a dll with following command :

csc /target:library /out:bank.dll a.cs

The windows Command Prompt responds with " 'csc' is not recognized ..."

I know in VS 2003 I can use the .NET Command Prompt. How do I do this for C# express so that my above dll build command will be recognized

thanks.



Answer this question

How do I build a dll from command line using C# express ?

  • chrisortman

    Thanks David,

    this worked great.


  • FALCO

    The C# command-line compiler is located in the .NET Framework directory. This folder is typically located here:

    %SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727

    For example:

    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727



  • Robert Vabo

    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>

    I can get to this point, but ...

    My C# source files and intended output folder for the dll is on another partion N:\

    When I navigate to my folder and enter command "csc /target:library /out:bank.dll a.cs" then this 'csc' command again is not recognized.


  • AttilaSzomor

    hi,

    It is working.

    thank u



  • simosnipe

    hi,

    go to your environmental  and double click path, then

    1) you will find some things written there don't omit anything just to go the end of the text

    2)put ";" 

    3) add this line and don't change anything and don't replace %systemroot% 

    %SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727

     

    hope this helps



  • CurtisDeHaven

    Hi,

    I added the path c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 to the system path in this way start->control pannel->performance and maintanance->system

    In the system->advanced->environmental variables->Path

    After adding this path i navigate to the folder where my cs file exists and type csc sample.cs,it is not working

    Please help me.

    Thanks in advance.

    Have a nice week end.

    Bye

    kal



  • ADurkin

    you welcome

  • blancblanc

    Shakalama,

    Regarding the publish question, can you start another thread for this We try to keep only a single question to each thread.



  • Rex Morgan

    1. Click Start -> Run
    2. In Open, type 'cmd' and click OK
    3. At the command prompt, type the following and press ENTER

      cd %SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727
    4. You can now use 'csc' at the command prompt.



  • Jeffr wilr

    hi, wadleys

    if you added this path" C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727" to your system path you don't need to call it every time

    just simply navigate to where your .cs file lies and compile it just once and after that every time navigate to its folder and type your file name

    for exampl if you have hello.cs file in c:/myfolder

    first time you navigate to there and you type csc hello.cs

    c:\myfolder > csc hello.cs

    next time just go there and type the file name it will be executed

    cd:\myfolder> hello

    hope that helps



  • Scott Coolness

    hi,

    yes this is exactly the same like java compiler but in java when i used to compile .class files i get new .java file but i don't see any file added even though the program still working

    more over when i publish any windows application and install it i don't know where the source file go its not in the program file and i don't know where all what i get is short cut in the startup menu

    would anyone kindly tell me where are those files go(to which folder)

    thx



  • rfairlie

    You simply need to add the Framework path to the path statement:

    1. Choose Start -> Control Panel -> System
    2. In the System dialog, choose the Advanced tab
    3. In the Advanced tab, click Environment variables
    4. Under System Variables, scroll down and double click the Path variable
    5. In the Variable value text box, append ';%SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727' and click OK, OK and OK again

    You should not be able to access csc in any folder at the command-line.



  • cya

    hi,

    just a question plz, in java i used to add the compiler path to the system, so i don't have to write all that line every time

    what can i do to make it the same for c#

    one more thing

    when i did compile the .cs file i didn't see the exe file beside it , where is it even its working on the cmd but i don't know where is the source

     

    thx



  • neutroncore

    when I click on the csc.exe appl. in this library it flashes by in an instant.

    How do I make it persist so I can enter commands


  • How do I build a dll from command line using C# express ?