Console App in one EXE file

Giganews Newsgroups
Subject: Console App in one EXE file
Posted by:  Gerry Hickman (gerry666uk2@newsgroup.nospam)
Date: Fri, 24 Oct 2008

Hi,

I have a simple console app (not using MFC) that must be able to run on any
current x86 Windows o/s without needing an installer, manifest, DLL,
VCRedist or other such nonsense.

In the past, I have some experience of using "static linking" to achieve
this, but I'm trying to find out the official Microsoft recommended way of
doing it?

I had a look in the docs for VS2008 and there are many pages about
application deployment, but nothing about making a single exe file to run
anywhere. The docs concentrate on "side-by-side assemblies", "manifests",
"click once", "MSI", "merge modules" etc. etc., none of which are useful for
(e.g.) running a console app against 1000 computers and piping output to a
central log, and anyway you get bogged down in creating target folder
structures, registry entries, admin rights, etc. etc.

They then have a page about using "xcopy". At first I thought this sounded
good, but when you read more closely, it says you have to xcopy the VCRedist
and then go to every machine and run it! This is not "xcopy" as such - it's
misleading...

My other question relates to what parts of Visual C++ and CRT are installed
to Windows by default? I found (for example), a dynamically linked program
written in VS2008 will run on other Vista machines, but will not run on
Win2k3 R2.

Final question; is is also possible to write a single EXE that will run on
x86, x64.

I realize that's quite a lot of questions!

Thanks for any help.

--
Gerry Hickman
London (UK)

Replies