views:

502

answers:

5

I don't want to download Visual Studio 2010.

  1. How can I start studying (not developing real applications) C# 4.0 and .NET 4.0 with just a text editor?

  2. Can I just download C# 4.0 compiler and .NET 4.0 framework and get started? How?

I have got Visual Studio 2008 but I learn from SO questions that it can't do the job.

+1  A: 

You need .NET framework 4.0 (if it exists already). Compiler is part of .NET package.

Edit: Just checked and .NET framework is in beta 2 stage. Wouldn't go there just yet.

Vladimir Kocjancic
Can you please post the download links? I got lost on the MicroSoft's website.
TheMachineCharmer
What's wrong with studying with the beta? As david said, he won't be writing real apps.
Martinho Fernandes
As long as the code is for testing purposes, there is nothing wrong with beta. However, too many times I have seen "testing" code transferred to real life production environment.Also in betas, usually, not all features work as described (if you are lucky) or even not at all.
Vladimir Kocjancic
+1  A: 

Use the command line compiler. Most text editors let you hook into this easily.

RichardOD
+2  A: 

The C# compiler is part of the .NET Framework.

You can find it under C:\Windows\Microsoft.NET\Framework\your_version_number\csc.exe

So, just open a text editor, write your source code, and compile it with the command line compiler.

Maximilian Mayerl
+3  A: 

Here are the download links:

LukeH
@Luke what is Web Bootstrapper? Is it necessary to download it?
TheMachineCharmer
@david: No, it's not necessary to download it. Choose *either* one of the standard installers from the first link *or* the web bootstrapper. From the web bootstrapper download page: *"This download consists of a new Web-based installer that simplifies the installation process."*
LukeH
+1  A: 

First go and download the beta 2 of the .NET framework 4 (current at the time of this writing).

Now, make sure C:\Windows\Microsoft.NET\Framework\v4.0.21006\ is in your PATH environment variable.

Here's the MSDN page for the command-line compiler so you can see the options. For simple things it usually boils down to this:

// compile an executable
$ csc /out:App.exe *.cs
// compile a library
$ csc /target:library /out:Lib.dll *.cs
// compile with a reference to System.Core.dll
$ csc /out:App.exe /r:System.Core.dll *.cs
// compile with a reference to Microsoft.CSharp.dll (you might need this to use dynamic)
$ csc /out:App.exe /r:Microsoft.CSharp.dll *.cs

Of course try to use an editor with syntax highlighting. I believe C# 4 only introduces three new keywords, so you should be fine even with highlighting for version 3 (in and out already existed, but they are now valid in a new context and dynamic is entirely new).

Martinho Fernandes
@Martinho - what's your preferred editor?
fieldingmellish
My fingers are wired to work in vim, but I don't like to recommend on religious matters ;) My usual advice is to pick a decent one (i.e. no Notepad) and learn out to use it to the best.
Martinho Fernandes
s/out to use/how to use/
Martinho Fernandes