Compile simple C# example in Web Matrix

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Guest's Avatar

    Compile simple C# example in Web Matrix

    I am trying to compile a simple c# class in Web Matrix called howdy.cs:


    // Program start class
    public class HowdyPartner
    {
    // Main begins program execution
    public static void Main()
    {
    // Write to console
    System.Console. WriteLine("Howd y, Partner!");
    }
    }

    However, it appears the 'Start' option is not available. What can I do to
    simply compile this class?

    I have heard there is a compiler in the SDK but I would have thought that
    would have been downloaded with WebMatrix or the .NET framework which is
    installed on my windowx xp machine.

    Appreciate some guidance to get my first pathetic C# class up and running :)

    Many thanks
    Jason


  • V. Jenks

    #2
    Compile simple C# example in Web Matrix

    I've never used web matrix but as I understand it, it is an
    asp.net development IDE, not made for compiling console
    apps. Correct me if I'm wrong.

    Take this modified version of your code:

    //BEGIN CODE----------------------------

    using System; //added System namespace!

    namespace TestClass //added custom namespace!
    {
    // Program start class
    public class HowdyPartner
    {
    // Main begins program execution
    public static void Main(string[] args) //added args!
    {
    // Write to console
    System.Console. WriteLine("Howd y, Partner!");
    }
    }
    }

    //END CODE------------------------------

    Paste it into notepad and save it as "HowdyPartner.c s"
    (without quotes - and make sure extention is ".cs" not ".txt")

    Compile it from the command-line using the C# compiler (csc).



    You must have the .net SDK installed, get it here if you
    don't already have it:



    And off you go!

    -v
    [color=blue]
    >-----Original Message-----
    >I am trying to compile a simple c# class in Web Matrix[/color]
    called howdy.cs:[color=blue]
    >
    >
    > // Program start class
    > public class HowdyPartner
    > {
    > // Main begins program execution
    > public static void Main()
    > {
    > // Write to console
    > System.Console. WriteLine("Howd y, Partner!");
    > }
    > }
    >
    >However, it appears the 'Start' option is not available. [/color]
    What can I do to[color=blue]
    >simply compile this class?
    >
    >I have heard there is a compiler in the SDK but I would[/color]
    have thought that[color=blue]
    >would have been downloaded with WebMatrix or the .NET[/color]
    framework which is[color=blue]
    >installed on my windowx xp machine.
    >
    >Appreciate some guidance to get my first pathetic C# class[/color]
    up and running :)[color=blue]
    >
    >Many thanks
    >Jason
    >
    >
    >.
    >[/color]

    Comment

    • Guest's Avatar

      #3
      Re: Compile simple C# example in Web Matrix

      Awesome! I did as intructed and downloaded the SDK and read through the sdk
      including the 'tools' section.

      However, I still don't see any refeence to the C# compiler...wher e is this
      tool?

      Many thanks
      Jason

      "V. Jenks" <anonymous@disc ussions.microso ft.com> wrote in message
      news:12c901c4df c8$b6433e90$a40 1280a@phx.gbl.. .
      I've never used web matrix but as I understand it, it is an
      asp.net development IDE, not made for compiling console
      apps. Correct me if I'm wrong.

      Take this modified version of your code:

      //BEGIN CODE----------------------------

      using System; //added System namespace!

      namespace TestClass //added custom namespace!
      {
      // Program start class
      public class HowdyPartner
      {
      // Main begins program execution
      public static void Main(string[] args) //added args!
      {
      // Write to console
      System.Console. WriteLine("Howd y, Partner!");
      }
      }
      }

      //END CODE------------------------------

      Paste it into notepad and save it as "HowdyPartner.c s"
      (without quotes - and make sure extention is ".cs" not ".txt")

      Compile it from the command-line using the C# compiler (csc).



      You must have the .net SDK installed, get it here if you
      don't already have it:



      And off you go!

      -v
      [color=blue]
      >-----Original Message-----
      >I am trying to compile a simple c# class in Web Matrix[/color]
      called howdy.cs:[color=blue]
      >
      >
      > // Program start class
      > public class HowdyPartner
      > {
      > // Main begins program execution
      > public static void Main()
      > {
      > // Write to console
      > System.Console. WriteLine("Howd y, Partner!");
      > }
      > }
      >
      >However, it appears the 'Start' option is not available.[/color]
      What can I do to[color=blue]
      >simply compile this class?
      >
      >I have heard there is a compiler in the SDK but I would[/color]
      have thought that[color=blue]
      >would have been downloaded with WebMatrix or the .NET[/color]
      framework which is[color=blue]
      >installed on my windowx xp machine.
      >
      >Appreciate some guidance to get my first pathetic C# class[/color]
      up and running :)[color=blue]
      >
      >Many thanks
      >Jason
      >
      >
      >.
      >[/color]


      Comment

      • Guest's Avatar

        #4
        Re: Compile simple C# example in Web Matrix

        Ok, I figured it out.

        To compile the simple howdy, cs one would do the following:

        1. Run | Command Prompt
        2. CD\ to your DIR containing file
        3. Use following statement:

        csc /t:library howdcy.cs

        However, I was getting the following error (Please see:
        http://www.communitymx.com/kbase.cfm?cid=1033)

        csc' is not recognized as an internal or external command, operable program
        or batch file.
        or
        'vbc' is not a recognized as an internal or external command, operable
        program or batch file.

        To work around this issue, you must place the path of the command line tools
        into the Path system variable. To do so:
        1.. Open the System Properties dialog from the Control Panel, or by right
        clicking on My Computer and choosing Properties, or by pressing [windows
        key] + [Pause/Break]
        2.. Click on the Advanced tab, and click the Environment Variables
        3.. Highlight the System Variable Path and click edit
        4.. Append the paths to the command line tools to the existing value

        By default, those paths are:
        c:\program files\microsoft visual studio
        ..NET\Framework SDK\BIN;c:\wind ows\microsoft.n et\framework\v1 .1.4322 - if you
        installed the SDK with Visual Studio, if you installed only the framework,
        the path would likely be:
        C:\WINDOWS\Micr osoft.NET\Frame work\v1.1.4322

        If you'd like more information on using the command line compiler, see the
        article:
        Demystifying .NET Compilers




        <jason@catamara nco.com> wrote in message
        news:%23CC9rOI4 EHA.1392@tk2msf tngp13.phx.gbl. ..[color=blue]
        > Awesome! I did as intructed and downloaded the SDK and read through the[/color]
        sdk[color=blue]
        > including the 'tools' section.
        >
        > However, I still don't see any refeence to the C# compiler...wher e is this
        > tool?
        >
        > Many thanks
        > Jason
        >
        > "V. Jenks" <anonymous@disc ussions.microso ft.com> wrote in message
        > news:12c901c4df c8$b6433e90$a40 1280a@phx.gbl.. .
        > I've never used web matrix but as I understand it, it is an
        > asp.net development IDE, not made for compiling console
        > apps. Correct me if I'm wrong.
        >
        > Take this modified version of your code:
        >
        > //BEGIN CODE----------------------------
        >
        > using System; //added System namespace!
        >
        > namespace TestClass //added custom namespace!
        > {
        > // Program start class
        > public class HowdyPartner
        > {
        > // Main begins program execution
        > public static void Main(string[] args) //added args!
        > {
        > // Write to console
        > System.Console. WriteLine("Howd y, Partner!");
        > }
        > }
        > }
        >
        > //END CODE------------------------------
        >
        > Paste it into notepad and save it as "HowdyPartner.c s"
        > (without quotes - and make sure extention is ".cs" not ".txt")
        >
        > Compile it from the command-line using the C# compiler (csc).
        >
        > http://www.publicjoe.f9.co.uk/csharp/cs04b2.html
        >
        > You must have the .net SDK installed, get it here if you
        > don't already have it:
        >
        >[/color]
        http://www.microsoft.com/downloads/d...displaylang=en[color=blue]
        >
        > And off you go!
        >
        > -v
        >[color=green]
        > >-----Original Message-----
        > >I am trying to compile a simple c# class in Web Matrix[/color]
        > called howdy.cs:[color=green]
        > >
        > >
        > > // Program start class
        > > public class HowdyPartner
        > > {
        > > // Main begins program execution
        > > public static void Main()
        > > {
        > > // Write to console
        > > System.Console. WriteLine("Howd y, Partner!");
        > > }
        > > }
        > >
        > >However, it appears the 'Start' option is not available.[/color]
        > What can I do to[color=green]
        > >simply compile this class?
        > >
        > >I have heard there is a compiler in the SDK but I would[/color]
        > have thought that[color=green]
        > >would have been downloaded with WebMatrix or the .NET[/color]
        > framework which is[color=green]
        > >installed on my windowx xp machine.
        > >
        > >Appreciate some guidance to get my first pathetic C# class[/color]
        > up and running :)[color=green]
        > >
        > >Many thanks
        > >Jason
        > >
        > >
        > >.
        > >[/color]
        >
        >[/color]




        Comment

        Working...