By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,360 Members | 3,011 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,360 IT Pros & Developers. It's quick & easy.

Compile simple C# example in Web Matrix

P: n/a
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("Howdy, 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
Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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("Howdy, Partner!");
}
}
}

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

Paste it into notepad and save it as "HowdyPartner.cs"
(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:

http://www.microsoft.com/downloads/d...displaylang=en

And off you go!

-v
-----Original Message-----
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("Howdy, Partner!");
}
}

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

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

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

Nov 19 '05 #2

P: n/a
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...where is this
tool?

Many thanks
Jason

"V. Jenks" <an*******@discussions.microsoft.com> wrote in message
news:12****************************@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("Howdy, Partner!");
}
}
}

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

Paste it into notepad and save it as "HowdyPartner.cs"
(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:

http://www.microsoft.com/downloads/d...displaylang=en

And off you go!

-v
-----Original Message-----
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("Howdy, Partner!");
}
}

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

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

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

Nov 19 '05 #3

P: n/a
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\FrameworkSDK\BIN;c:\windows\microsoft.net\fr amework\v1.1.4322 - if you
installed the SDK with Visual Studio, if you installed only the framework,
the path would likely be:
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322

If you'd like more information on using the command line compiler, see the
article:
Demystifying .NET Compilers
http://www.communitymx.com/abstract....938E090C326799

<ja***@catamaranco.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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...where is this
tool?

Many thanks
Jason

"V. Jenks" <an*******@discussions.microsoft.com> wrote in message
news:12****************************@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("Howdy, Partner!");
}
}
}

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

Paste it into notepad and save it as "HowdyPartner.cs"
(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:

http://www.microsoft.com/downloads/d...displaylang=en
And off you go!

-v
-----Original Message-----
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("Howdy, 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
.




Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.