Connecting Tech Pros Worldwide Forums | Help | Site Map

Hello World without using VS.NET

Andy Sutorius
Guest
 
Posts: n/a
#1: Jul 21 '05
Has anyone successfully created a Hello World program without using Visual
Studio.NET? If so, what IDE did you use and what namespaces did you import?

Thanks!

Andy Sutorius



John Q
Guest
 
Posts: n/a
#2: Jul 21 '05

re: Hello World without using VS.NET


Step 1: Write the code

public class Hell

public static void Main(

System.Console.WriteLine("Hello, World.")



Step 2: Save and compile

(On command line) csc.exe HelloWorld.c

Step 3: Run it

HelloWorld.ex

Hello, World
John Q
Guest
 
Posts: n/a
#3: Jul 21 '05

re: Hello World without using VS.NET


Step 1: Write the code

public class Hell

public static void Main(

System.Console.WriteLine("Hello, World.")



Step 2: Save and compile

(On command line) csc.exe HelloWorld.c

Step 3: Run it

HelloWorld.ex

Hello, World
Tom Dacon
Guest
 
Posts: n/a
#4: Jul 21 '05

re: Hello World without using VS.NET


If you have the .NET SDK installed, you have all the compilers and linkers
and assemblies you need. You can use Notepad or any other text editor to
create and modify the source code, and then use the command line compilers
to create the executables. For instance, key in the following code in
Notepad and save it as Hello.cs. Then from a command window, type
csc Hello.cs
and you'll get Hello.exe. Run Hello.exe and you'll get the hello world
message in a command window.

Here's the code:

using System;

namespace HelloWorldInCSharp
{
class HelloWorldApp
{
static void Main(string[] args)
{
Console.WriteLine("Hello World from C#!");
Console.ReadLine();
}
}
}

The command line compilers and linkers can be used to build any kind of
application or library assembly. There are many command switches. Try csc /?
to get an idea of what's available.

I haven't personally done this since VS.Net was released, so I don't
remember what you need to set up in order to make this work so easily.
Probably some paths need to be set up in the execution environment for the
command window. Look at the SDK documentation to see what needs to be done
by way of environment variables.

If you don't have the .NET SDK, you can get it from the Microsoft site
(without charge, as I understand it).

Good luck,
Tom Dacon
Dacon Software Consulting


"Andy Sutorius" <andy@sutorius.com> wrote in message
news:oJBfc.19909$yv.321236@twister.southeast.rr.co m...[color=blue]
> Has anyone successfully created a Hello World program without using Visual
> Studio.NET? If so, what IDE did you use and what namespaces did you[/color]
import?[color=blue]
>
> Thanks!
>
> Andy Sutorius
>
>[/color]


Tom Dacon
Guest
 
Posts: n/a
#5: Jul 21 '05

re: Hello World without using VS.NET


If you have the .NET SDK installed, you have all the compilers and linkers
and assemblies you need. You can use Notepad or any other text editor to
create and modify the source code, and then use the command line compilers
to create the executables. For instance, key in the following code in
Notepad and save it as Hello.cs. Then from a command window, type
csc Hello.cs
and you'll get Hello.exe. Run Hello.exe and you'll get the hello world
message in a command window.

Here's the code:

using System;

namespace HelloWorldInCSharp
{
class HelloWorldApp
{
static void Main(string[] args)
{
Console.WriteLine("Hello World from C#!");
Console.ReadLine();
}
}
}

The command line compilers and linkers can be used to build any kind of
application or library assembly. There are many command switches. Try csc /?
to get an idea of what's available.

I haven't personally done this since VS.Net was released, so I don't
remember what you need to set up in order to make this work so easily.
Probably some paths need to be set up in the execution environment for the
command window. Look at the SDK documentation to see what needs to be done
by way of environment variables.

If you don't have the .NET SDK, you can get it from the Microsoft site
(without charge, as I understand it).

Good luck,
Tom Dacon
Dacon Software Consulting


"Andy Sutorius" <andy@sutorius.com> wrote in message
news:oJBfc.19909$yv.321236@twister.southeast.rr.co m...[color=blue]
> Has anyone successfully created a Hello World program without using Visual
> Studio.NET? If so, what IDE did you use and what namespaces did you[/color]
import?[color=blue]
>
> Thanks!
>
> Andy Sutorius
>
>[/color]


Andy Sutorius
Guest
 
Posts: n/a
#6: Jul 21 '05

re: Hello World without using VS.NET


Wow. Thanks. By chance would you have this same simple app in VB.NET?

Sincerely,

Andy Sutorius


Andy Sutorius
Guest
 
Posts: n/a
#7: Jul 21 '05

re: Hello World without using VS.NET


Wow. Thanks. By chance would you have this same simple app in VB.NET?

Sincerely,

Andy Sutorius


Jon Skeet [C# MVP]
Guest
 
Posts: n/a
#8: Jul 21 '05

re: Hello World without using VS.NET


Tom Dacon <Tom-@t-dacons.com> wrote:[color=blue]
> If you have the .NET SDK installed, you have all the compilers and linkers
> and assemblies you need.[/color]

You don't even need the SDK installed - the .NET framework itself comes
with the C# and VB.NET compilers.
[color=blue]
> I haven't personally done this since VS.Net was released, so I don't
> remember what you need to set up in order to make this work so easily.
> Probably some paths need to be set up in the execution environment for the
> command window. Look at the SDK documentation to see what needs to be done
> by way of environment variables.[/color]

Just including the framework directory (eg
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322) on the path is enough.

I use csc all the time - it's much quicker to type in code in a quick
text editor and compile it using csc than it is to wait for VS.NET to
start up, find or create an appropriate solution/project, and then put
the code in, when it comes to quick programs for newsgroup posts, for
instance.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jon Skeet [C# MVP]
Guest
 
Posts: n/a
#9: Jul 21 '05

re: Hello World without using VS.NET


Tom Dacon <Tom-@t-dacons.com> wrote:[color=blue]
> If you have the .NET SDK installed, you have all the compilers and linkers
> and assemblies you need.[/color]

You don't even need the SDK installed - the .NET framework itself comes
with the C# and VB.NET compilers.
[color=blue]
> I haven't personally done this since VS.Net was released, so I don't
> remember what you need to set up in order to make this work so easily.
> Probably some paths need to be set up in the execution environment for the
> command window. Look at the SDK documentation to see what needs to be done
> by way of environment variables.[/color]

Just including the framework directory (eg
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322) on the path is enough.

I use csc all the time - it's much quicker to type in code in a quick
text editor and compile it using csc than it is to wait for VS.NET to
start up, find or create an appropriate solution/project, and then put
the code in, when it comes to quick programs for newsgroup posts, for
instance.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jon Skeet [C# MVP]
Guest
 
Posts: n/a
#10: Jul 21 '05

re: Hello World without using VS.NET


Andy Sutorius <andy@sutorius.com> wrote:[color=blue]
> Wow. Thanks. By chance would you have this same simple app in VB.NET?[/color]

Option Strict On

Imports System

Class Test
Shared Sub Main()
Console.WriteLine ("Hello, world")
End Sub
End Class

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jon Skeet [C# MVP]
Guest
 
Posts: n/a
#11: Jul 21 '05

re: Hello World without using VS.NET


Andy Sutorius <andy@sutorius.com> wrote:[color=blue]
> Wow. Thanks. By chance would you have this same simple app in VB.NET?[/color]

Option Strict On

Imports System

Class Test
Shared Sub Main()
Console.WriteLine ("Hello, world")
End Sub
End Class

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Andy Sutorius
Guest
 
Posts: n/a
#12: Jul 21 '05

re: Hello World without using VS.NET


Jon,

Have you tried to compile a vb.net program like you mention using csc
(obviously using vbc)

Thanks,

Andy Sutorius


Andy Sutorius
Guest
 
Posts: n/a
#13: Jul 21 '05

re: Hello World without using VS.NET


Jon,

Have you tried to compile a vb.net program like you mention using csc
(obviously using vbc)

Thanks,

Andy Sutorius


Andy Sutorius
Guest
 
Posts: n/a
#14: Jul 21 '05

re: Hello World without using VS.NET


Hi Tom,

I have set up the Path, Lib and Include system variables and csc is
compiling quite nicely. However, VB.net is a different story. I am trying to
port over a C# console app to VB.NET but am getting confused with what is
"required" by VB.NET. Statements that VS.NET puts in automatically.



Andy Sutorius
Guest
 
Posts: n/a
#15: Jul 21 '05

re: Hello World without using VS.NET


Hi Tom,

I have set up the Path, Lib and Include system variables and csc is
compiling quite nicely. However, VB.net is a different story. I am trying to
port over a C# console app to VB.NET but am getting confused with what is
"required" by VB.NET. Statements that VS.NET puts in automatically.



Cos Callis
Guest
 
Posts: n/a
#16: Jul 21 '05

re: Hello World without using VS.NET


Andy
Jon is not correct re: vbc.exe being installed w/the .NET framework. It does require the .NET SDK (only the C# compiler is installed w/the framework
Once that is install the framework SDK you then need to either
A) Go to the console using the VS 2003 (or 2002) Command Promp
(Start->Programs->VS.NET 2003->VS.NET Tools->VS 2003 Command Prompt
[This is NOT the normal command prompt
-OR
B) Locate Corvars.bat (by default it is @ C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Bin\corvars.ba
and add this location to the Path. (this will allow you to run vbc from any place, and from the "normal" comman
prompt

This proceedure is discribed in Programming Microsoft Visual Basic .NET, MS Press, by Francisco Balena (pp23-24) which I teach from and highly recommend

HTH

Cos Callis, MCAD
Cos Callis
Guest
 
Posts: n/a
#17: Jul 21 '05

re: Hello World without using VS.NET


Andy
Jon is not correct re: vbc.exe being installed w/the .NET framework. It does require the .NET SDK (only the C# compiler is installed w/the framework
Once that is install the framework SDK you then need to either
A) Go to the console using the VS 2003 (or 2002) Command Promp
(Start->Programs->VS.NET 2003->VS.NET Tools->VS 2003 Command Prompt
[This is NOT the normal command prompt
-OR
B) Locate Corvars.bat (by default it is @ C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Bin\corvars.ba
and add this location to the Path. (this will allow you to run vbc from any place, and from the "normal" comman
prompt

This proceedure is discribed in Programming Microsoft Visual Basic .NET, MS Press, by Francisco Balena (pp23-24) which I teach from and highly recommend

HTH

Cos Callis, MCAD
Jon Skeet [C# MVP]
Guest
 
Posts: n/a
#18: Jul 21 '05

re: Hello World without using VS.NET


Andy Sutorius <andy@sutorius.com> wrote:[color=blue]
> Have you tried to compile a vb.net program like you mention using csc
> (obviously using vbc)[/color]

Absolutely. Just setting the path is all I needed to do.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jon Skeet [C# MVP]
Guest
 
Posts: n/a
#19: Jul 21 '05

re: Hello World without using VS.NET


Andy Sutorius <andy@sutorius.com> wrote:[color=blue]
> Have you tried to compile a vb.net program like you mention using csc
> (obviously using vbc)[/color]

Absolutely. Just setting the path is all I needed to do.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jon Skeet [C# MVP]
Guest
 
Posts: n/a
#20: Jul 21 '05

re: Hello World without using VS.NET


Cos Callis <anonymous@discussions.microsoft.com> wrote:[color=blue]
> Andy,
> Jon is not correct re: vbc.exe being installed w/the .NET framework.
> It does require the .NET SDK (only the C# compiler is installed w/the
> framework)[/color]

I don't know whether that was true for 1.0 or not, but it's certainly
not true for 1.1.

I've just taken a clean Windows 2000 box and installed the .NET 1.1
Redistributable Package, and I was then able to compile and run the
simple hello world program I previously posted.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jon Skeet [C# MVP]
Guest
 
Posts: n/a
#21: Jul 21 '05

re: Hello World without using VS.NET


Cos Callis <anonymous@discussions.microsoft.com> wrote:[color=blue]
> Andy,
> Jon is not correct re: vbc.exe being installed w/the .NET framework.
> It does require the .NET SDK (only the C# compiler is installed w/the
> framework)[/color]

I don't know whether that was true for 1.0 or not, but it's certainly
not true for 1.1.

I've just taken a clean Windows 2000 box and installed the .NET 1.1
Redistributable Package, and I was then able to compile and run the
simple hello world program I previously posted.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Cor Ligthert
Guest
 
Posts: n/a
#22: Jul 21 '05

re: Hello World without using VS.NET


Hi Andy,

Will you be so kind next time not to multipost (send seperate messages to
different newsgroups)

You have a lot of answers in the VB.language group and Jon could not see
that, when you had sent this to those group in one line with a delimiter
between the addressed newsgroups, Jon would probably not even had taken time
to answer your VB. question.

However he has that ready because that is his sample to show that C# and
VB.net are when compiled almost the same.

:-)

Thanks in advance for the next time,

Cor


Cor Ligthert
Guest
 
Posts: n/a
#23: Jul 21 '05

re: Hello World without using VS.NET


Hi Andy,

Will you be so kind next time not to multipost (send seperate messages to
different newsgroups)

You have a lot of answers in the VB.language group and Jon could not see
that, when you had sent this to those group in one line with a delimiter
between the addressed newsgroups, Jon would probably not even had taken time
to answer your VB. question.

However he has that ready because that is his sample to show that C# and
VB.net are when compiled almost the same.

:-)

Thanks in advance for the next time,

Cor


Evan Freeman[C++ Samuri]
Guest
 
Posts: n/a
#24: Jul 21 '05

re: Hello World without using VS.NET


I just have to throw my 2 cents in here =]

You can also use the eclipse project now, which is open source try google
search to find it, to compile and run C# programs as well as VB.NET
programs. You just need the .NET SDK and so on installed and the appropriate
Eclipse modules. Take a look.

-Evan


"Andy Sutorius" <andy@sutorius.com> wrote in message
news:oJBfc.19909$yv.321236@twister.southeast.rr.co m...[color=blue]
> Has anyone successfully created a Hello World program without using Visual
> Studio.NET? If so, what IDE did you use and what namespaces did you[/color]
import?[color=blue]
>
> Thanks!
>
> Andy Sutorius
>
>[/color]


Evan Freeman[C++ Samuri]
Guest
 
Posts: n/a
#25: Jul 21 '05

re: Hello World without using VS.NET


I just have to throw my 2 cents in here =]

You can also use the eclipse project now, which is open source try google
search to find it, to compile and run C# programs as well as VB.NET
programs. You just need the .NET SDK and so on installed and the appropriate
Eclipse modules. Take a look.

-Evan


"Andy Sutorius" <andy@sutorius.com> wrote in message
news:oJBfc.19909$yv.321236@twister.southeast.rr.co m...[color=blue]
> Has anyone successfully created a Hello World program without using Visual
> Studio.NET? If so, what IDE did you use and what namespaces did you[/color]
import?[color=blue]
>
> Thanks!
>
> Andy Sutorius
>
>[/color]


Closed Thread


Similar .NET Framework bytes