1

for strict constrains in my scenarios, I have very few room to install my application, and .net framework is not installable (any version). If the application is really simple (more or less), it is possible to create an application in visual studio (in c#) with no dependendency from the .net framework?

Thanks!

ff8mania
  • 1,553
  • 3
  • 19
  • 28
  • 2
    You should be aware that after all said and done (below), Windows does come with .net anyway!? http://stackoverflow.com/a/15615685/1017882 –  Oct 10 '13 at 08:21
  • When you talk about the limited space, are your referring to your own machine or the one on which this hypothetical C# application would run? – Andrei V Oct 10 '13 at 08:27
  • You can't run a C# application without .NET framework. However, if you lack hdd space, you can install only the runtime environment of .NET from here http://www.microsoft.com/en-us/download/details.aspx?id=26 – Ovidiu Oct 10 '13 at 08:28
  • The every first question is, what kind of OS will your application run on? – Teddy Oct 10 '13 at 08:28
  • Why are you deploying to machines that do not include .net? Are you writing software for windows 95 or nt4? – David Heffernan Oct 10 '13 at 08:31

5 Answers5

2

Short answer: NO.

There is no way to create a .NET application without any framework.

nvoigt
  • 75,013
  • 26
  • 93
  • 142
  • 1
    Actually incorrect. C# is a language, .net is a framework. Strictly speaking, C# is not dependent on the .net framework. –  Oct 10 '13 at 08:16
  • 2
    @DeeMac It's an icorrect answer to your hypothetical question. But I tried to answer the posters very real question above (using VS) and for this question, it's a correct answer. – nvoigt Oct 10 '13 at 08:19
  • What is my hypothetical question? –  Oct 10 '13 at 08:20
  • So is it possible to write a program in C# without using .Net framework? I didn't know that. – Vikneshwar Oct 10 '13 at 08:20
  • You can write it, just not compile it. – Gareth Oct 10 '13 at 08:21
  • It is possible to write C# without .net yes. –  Oct 10 '13 at 08:21
  • @DeeMac This answer is correct, `it is possible to create an application in visual studio` Visual studio itself built on top of *.Net Framework* – Sriram Sakthivel Oct 10 '13 at 08:23
  • So it means automatically he will be using .Net. – Vikneshwar Oct 10 '13 at 08:24
  • @DeeMac How to do that? Curious. AFAIK You need to create a `Main` method in a class to work(which implicitly derives from `System.Object`) unfortunately `System.Object` doesn't belongs to c# it belongs to .net FW(strictly speaking BCL in mscorlib.dll) – Sriram Sakthivel Oct 10 '13 at 08:25
  • And If I decide not to use VS, is there any diffenrece? – ff8mania Oct 10 '13 at 08:29
  • @ff8mania Of course you can write it in a notepad, but how'll you compile it without .net framework? – Sriram Sakthivel Oct 10 '13 at 08:30
  • I'm with @DeeMac: this answer is not correct. There are ways to "create an application in visual studio (in c#) with no dependendency from the .net framework". – David Arno Oct 10 '13 at 08:54
1

It is possible to compile a C# app such that it has no dependencies on any of the built-in .NET types & libraries, by using the /nostdlib switch (see http://msdn.microsoft.com/en-us/library/fa13yay7.aspx). You then need to supply your own System namespace.

However, this doesn't remove the need for the .NET framework on the target machine if you use the standard C# compiler. As well as containing the built-in types, the framework also includes the JIT IL compiler, the CLR extra, which all .NET executables and dll's are reliant on.

There are ways of compiling C# code such that it doesn't need the framework though. The Xamarin product for example (http://xamarin.com/), supports compiling C# code to native iOS apps, which are wholely independent of the .NET framework. I'm not aware of any equivalent for "desktop" OS's though.

David Arno
  • 42,717
  • 16
  • 86
  • 131
0

Writing, compiling and running a C# program without .Net means running a special C# compiler that produces native code instead of managed code. I think such a compiler exists from WinRT for mobile phones, which uses COM instead of .Net (And C++/CX instead of C++/CLI). Code it produces does not depend on the .Net Framework, but does depend on the WinRT runtime.

Medinoc
  • 6,577
  • 20
  • 42
0

You may create mono GTK# application and then use mkbundle to generate independent executable. You can use Visual Studio to build your logic and use Xamarin studio to build GTK# GUI. For more information about mkbundle see this and this.

Deffiss
  • 1,136
  • 7
  • 12
-1

To reply to your query. It really is not possible to create a .Net application without the .Net frame work. And moreover if you have installed Visual Studio by default it would have asked you to install .Net framework or would have installed it by default. In that scenario there is already .Net framework installed in your PC.

Thanks

Vikneshwar
  • 1,029
  • 4
  • 20
  • 38
  • You have misunderstood the OP, he's not asking to develop a .net app, just a C# app without .net –  Oct 10 '13 at 08:20
  • But he is asking to create an application using Visual Studio. So in that case i guess i was right. I dint know that a C# program could run without using .Net – Vikneshwar Oct 10 '13 at 08:23