views:

60

answers:

3

I am new to .NET, and I want to create a simple application in .NET using VC++. I have to run this application in other systems. Do I need to install .NET framework on the other systems to run this application?

If I need to install, is there any other way to create and run the application without .NET framework?

+4  A: 

VC++ is not typically used for building .NET applications. You can target .NET with VC++ using the C++/CLI language extensions but that's primarily intended for interoperability with other .NET languages.

Native (i.e. normal) C++ applications will not depend on the .NET framework.

If you're application depends on .NET you will have to ensure that the framework is installed on the user PC. Though some versions of Windows come with a version of the .NET framework pre-installed (see http://stackoverflow.com/questions/71390/which-operating-systems-come-with-net).

Alexandre Jasmin
I don't know how typical it is, but some people really like the C++/CLI, since they can mix C++ features and the .NET runtime. I agree it's probably more for performance reasons, but C++/CLI has some cool features that other .NET languages don't.
Merlyn Morgan-Graham
+1  A: 

Yes. If you target .net, it has to have the .net framework to run. If you use unmanaged c++ then you don't have to have the .net framework on the target machine. But, then it won't be a .net application.

kirk.burleson
+1  A: 

Yes you can create applications targeting .NET using VC++. You need to use the /clr flag to tell the compiler that you are targeting the CLR (common language runtime). There are additional options available for /clr so check out Microsoft's info about it. In most cases /clr without options will be sufficient.

Unless you have a specific need to mix native code (= unmanaged C++) and CLR byte code (= managed C++) I would recommend using a language that was designed specifically for .NET. C# is the prime candidate. With a good C++ background you will find that C# as such is not the big challenge. You probably will spend more time on learning the class libraries.

Regardless of the language you use to produce byte code for the CLR, the .NET framework needs to be available on the target computer or device. Microsoft provides that either as part of the operating system or as a separate download. As an alternative, in particular for non-Microsoft platforms the Mono project might be an option.

John