views:

210

answers:

6

I want to develop a small utility for windows and I prefer doing that in c# because it is easier (I'm a java developer).

The utility will be available for download by many people and I assume some of them will not have the .net framework installed (is this assumption correct, say I target win xp and above?)

My question is: can a c# application be compiled in a way that it will not require the .net framework installed?

Thank you

+6  A: 

No, it will need the .Net framework installed. Note though that you will need only the redistributable version, not the SDK.

Fredrik Mörk
A: 

You can probably also include the .net framework installer in your application.

Thomas Stock
+4  A: 

Normally, you will need the .NET Framework being installed on the target system. There is no simple way around that.

However, certain third-party tools such as Xenocode or Salamander allow you to create stand-alone applications. See this related question:

Is there some way to compile a .NET application to native code?

As these solutions are not straight-forward and require commercial products I would recommend you to create a simple Visual Studio Setup and Deployment project. In the properties of the project you should include the .NET Framework as a pre-requisite. The setup.exe created will then automatically download and install the .NET Framework prior to installing your application.

0xA3
A: 

No, the runtime is required to JIT (Just In Time) compile your assembly for the native CPU (x86/X86-64/Itanium).

Sean
+2  A: 

A minor aside - but in this scenario, consider developing the utility in Silverlight - it has a much smaller footprint and is supported on a number of operating systems. This might allow you to get the coverage including people who don't already have .NET.

If you need "normal" .NET, then "Client Profile" is perhaps an option.

Marc Gravell
A: 

In a related question, Can you compile C# without using the .Net framework?, it's mentioned you could do this using mkbundle from mono. I haven't tried it myself so I can't comment on if it's the way you should go, but you may want to consider it.

Liron Yahdav