Ali Bahraminezhad Ali Bahraminezhad - 8 days ago 4
C++ Question

Visual C++ 2010 and Native executable file

Native exe!
that means my program can run easily without any requirement?
even if I use .net classes?

You know I want to write a program that is so light and I don't like to use C# or any other .net programing language because all of them need .net-framework 4.5.

Just think a 2.5 MB programm needs a +250 MB .netframework.

New Update - 12/01/2016:

It's almost 4 years ago when I asked this question. As you know

Dotnet Native
is announced. It's an interesting feature which compile
IL
into native code.

Compiling Apps with .NET Native


.NET Native is a precompilation technology for building and deploying
Windows apps that is included with Visual Studio 2015. It
automatically compiles the release version of apps that are written in
managed code (C# or Visual Basic) and that target the .NET Framework
and Windows 10 to native code. Typically, apps that target the .NET
Framework are compiled to intermediate language (IL). At run time, the
just-in-time (JIT) compiler translates the IL to native code. In
contrast, .NET Native compiles Windows apps directly to native code.
For developers, this means:


  • Your apps will provide the superior performance of native code.

  • You can continue to program in C# or Visual Basic.

  • You can continue to take advantage of the resources provided by the .NET Framework, including its class library, automatic memory
    management and garbage collection, and exception handling.



Answer

Last I checked none of the .NET frameworks were 250+ MB! Yes, the offline installer for .NET Framework 3.5 SP1 is 231MB but it contains x86 and x64 versions of .NET 2, 3 and 3.5 sp1.

You should read this http://www.smallestdotnet.com for details on sizes of various versions of the installers.

Now on to your question:
Yes, It is a little annoying to have your clients install a big framework, even 20-40MB does get annoying. With .NET, the advantage is the ease of programming (In my opionion) compared to other Native options.

Your native options are:
MFC - You need only the VS runtimes installed, which is 1-2MB and is usually installed on newer pcs. Also, you can ship your application with the MFC libraries packaged into a dll which is again <2MB

The trade of here is you need to program in C++, the libraries overall are a very thin layer over the native libraries. and people have had harsh opinions about MFC. I've barely just tried it.

Win32 API - This is going all bare bones, and quite difficult, you could use C or C++ but you'd really have to know a lot about the Win32 API and how windows itself works (Stuff like windows messages, hwnds etc) Its not fun, believe me. But during deployment you would not need any external libraries.

There are tons more options, see here:
Native Windows Application Development Options
http://stackoverflow.com/questions/2711599/what-programming-language-should-i-use-to-create-small-native-windows-applicatio

Here are some links on MFC that might help:
Want to learn Windows Programming,some suggestions?
How do I decide whether to use ATL, MFC, Win32 or CLR for a new C++ project?
C++ MFC vs .NET?
http://stackoverflow.com/questions/557114/stick-with-mfc-or-go-to-net