views:

9892

answers:

11

This is truly a beginner question, so I apologize in advance.

I have Visual Studio 2008 Standard installed and would like to create a small Windows application that does NOT require any .NET framework when run on computers. Does VS 2008 Standard support such a feature? Any pointers on how to accomplish this would be fantastic.

Thanks in advance.

+3  A: 

Sure, you can definitely do this. You'll have to write your application in C++, though.

To get started, go to File | New, and under Project Types pick one of the options under Visual C++. For the minimal dependencies, I would suggest one of the Win32 options. Both the "Win32 Console Application" and the "Win32 Project" options appear to take you to the same wizard, which if you click Application Settings on the left lets you pick whether to create a console app or a windows app. A console app will run in a console window like cmd.exe, whereas a windows app will initially have no UI (you'll have to do the UI yourself).

Be aware that even if you don't depend on the .NET runtime, you'll still need to have the CRT dlls available on machines that will be running your program. The redistributables for these live under the Visual Studio install dir, which if you installed in the default location would be C:\Program Files\Microsoft Visual Studio 9.0\VC\redist.

Charlie
You can statically link the CRT files, though. It's a linker option. It makes your executable a bit bigger, but then it's truly a standalone executable.
Niki
A: 

doh!

Charlie, thanks for the feedback. So Visual C# or Visual Basic don't have the possibility of running without the .NET framework? I remember that we used to have a VB 6.0 install and were able to created standalone (non .NET) windows applications.

You would better comment responses here in comment area.
Alexander Prokofyev
Even VB6 apps compiled as so-called native executables were still dependent upon the VB runtime DLLs being present, so you usually couldn't distribute just the EXE. If you want a truly standalone app, you need to use C++ or Delphi.
MusiGenesis
I seem to remember a version of Windows that included the VB runtime, no?
kenny
@Kenny: yeah, I think it was Windows ME. It was always considered good form to include the runtimes in an installer, even though it added 3 WHOLE FLOPPY DISKS to your install package. Man, Visual Basic talk takes me back.
MusiGenesis
A: 

VB 6 is not based on the .NET framework. VB**.NET** is.

Chris
A: 

So what about VB within Visual Studio 2008 Standard? Was the VB engine rewritten for the .NET platform?

Chris is correct that VB.NET (the one that comes with VS 2008) does require the .NET runtime. I think if you want to use C# or VB from VS 2008, you're going to have to use the .NET runtime with it.
Charlie
+4  A: 

There are third party compilers like Salamander (damn expensive).

See also: http://stackoverflow.com/questions/45702/is-there-some-way-to-compile-a-net-application-to-native-code

Corbin March
+1  A: 

If I wanted to create a truly standalone Windows EXE application easily, I would use Delphi. Good thing I don't want to do that. .NET is too useful, and (at least version 2.0) is pretty much everywhere already - it's rare that I encounter a client machine without .NET already installed, and even if it isn't there the installer is only 23 MB.

Back in my Visual Basic days, I used to fret about the added burden of having to deploy the VB runtimes along with my application proper. It never ended up being a significant problem.

MusiGenesis
Scott Hanselman has iunformation to help you find even smaller installations (if applicable)...http://www.hanselman.com/blog/SmallestDotNetOnTheSizeOfTheNETFramework.aspxandhttp://www.hanselman.com/smallestdotnet
Doug L.
I think the "smaller" installs are just little stub-type things that still have to download a mess of stuff. I wouldn't bother with any of it - I've never had a client barf over a 23 MB file.
MusiGenesis
A: 

VB.Net has little in common with VB6. If you want to understand the degree of difference, see http://vb.mvps.org/vfred/breaks.asp

Bob Moore
A: 

Also,

There supposed to be several inexpensive (i.e., rather cheap) tools that would link non-net app's DLL(s) together, such as:

  1. Molebox Pro (eu 100)
  2. BitArt's Fusion ($160)
  3. VB Wrap ($100)
  4. PE Bundle ($30)

Additionally,

There's a protection-oriented tool called "Themida" from www.oreans.com that, if purchased along with another one of their tool called "XBundler For Win32/.NET", it promises to have (quote) "DLLs and data files to be embedded inside an application".

Themida sells for eu 200 plus XBundler, selling for eu 120, one can have both for eu 320, which ain't too cheap but not too expensive either.

EXE admirer :-)

A: 

The only way I have seen anyone get a standalone (not requiring .net to be installed) exe from C# or VB.net is using a program that wraps the framework (at least, the used libraries) in with your exe. And those cost money. you won't find any other way to do it. It's like trying to run a Java app without the Java VM

Joel
A: 

You doesn't need to deploy the redist dll's if you link your c/c++ statically. You can force that in the project settings, add a "/MT" to the compile command (without the quotes) if I remember correctly. Then he can just send off his exe and he won't need to send off the crt dlls also.

Of course, that means he won't pick up newly released features in windows updates of those dll's, but there's always a trade-off I suppose.

--edit: Ok, I found the switch that adds that argument; on the Property Page, Configuration Properties -> C/C++ -> Code Generation then "Runtime Library" should be set to an "non-dll" option. The two are /MT and /MTd (debug).

A: 

How do you do it with a project you've already created?