471,310 Members | 1,362 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

Single File Exe

Using Visual Studio 2005 and C#, is there a way to create a single file
executable out of my project?

We have made database tools that our employees use out on the manufacturing
floor, and the executables are located on a central server.

Our IT guy wants our executables to be contained in a single file like they
were back when they used VB6, but .NET doesn't like this very well. He keeps
copying the executables (after extracting them using our setup) to different
folders, and naturally, they don't run because other files are missing. He is
hard headed and has more seniority than I do, so me telling him how to
install files is out of the question.
Jun 27 '08 #1
5 1782
On Jun 11, 4:34 pm, jp2msft <jp2m...@discussions.microsoft.comwrote:
Using Visual Studio 2005 and C#, is there a way to create a single file
executable out of my project?
What other files do you have? If it's just other assemblies, there's a
tool called ilmerge which might help, although I haven't tried it
myself.

If it's resource files, you could certainly bundle them in the
executable.

If it's a .config file, I think you're out of luck.

Jon
Jun 27 '08 #2
As far as I can tell, it's just the other assemblies. For output name
"ThisIsMine.exe", there would also be:
ThisIsMine.pdb
ThisIsMine.vshost.exe

At least, that's all the files I found in the "bin\Release" folder. I tried
copying all of these files over, but sometimes it works, sometimes it doesn't
(depending on which PC I test it on).

While I have an MVP on the line, what is the "obj" folder for (i.e.
"obj\Release")?

"Jon Skeet [C# MVP]" wrote:
On Jun 11, 4:34 pm, jp2msft <jp2m...@discussions.microsoft.comwrote:
Using Visual Studio 2005 and C#, is there a way to create a single file
executable out of my project?

What other files do you have? If it's just other assemblies, there's a
tool called ilmerge which might help, although I haven't tried it
myself.

If it's resource files, you could certainly bundle them in the
executable.

If it's a .config file, I think you're out of luck.

Jon
Jun 27 '08 #3
jp2msft <jp*****@discussions.microsoft.comwrote:
As far as I can tell, it's just the other assemblies. For output name
"ThisIsMine.exe", there would also be:
ThisIsMine.pdb
ThisIsMine.vshost.exe
The pdb is debugging information, and the .vshost.exe file is just for
Visual Studio. In other words, you don't need either of them.

If that's all that was in your directory, then just provide the .exe -
that's all you need to run the code.
While I have an MVP on the line, what is the "obj" folder for (i.e.
"obj\Release")?
Essentially it's for temporary files for the compiler. You shouldn't
need to worry about it :)

--
Jon Skeet - <sk***@pobox.com>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
Jun 27 '08 #4
jp2msft wrote:

using our setup) to different folders, and naturally, they don't run
because other files are missing. He is hard headed and has more
I noticed in your reply to Jon you mentioned that on your output dir on
the dev box there was just the .exe (plus the dev files you don't need
to distribute) It sounds like you may possibly have a dependency on
another assembly that maybe is part of your setup, what is delivered
into the target directory by the installation process?

Cheers Tim.

--

Jun 27 '08 #5
You have a couple of options for this:
1) put all your class files into the same project as the EXE and all will be
compiled into same.
2) Use the ILMerge utility to combine all into the EXE after building the
solution.
--Peter
"jp2msft" <jp*****@discussions.microsoft.comwrote in message
news:D6**********************************@microsof t.com...
Using Visual Studio 2005 and C#, is there a way to create a single file
executable out of my project?

We have made database tools that our employees use out on the
manufacturing
floor, and the executables are located on a central server.

Our IT guy wants our executables to be contained in a single file like
they
were back when they used VB6, but .NET doesn't like this very well. He
keeps
copying the executables (after extracting them using our setup) to
different
folders, and naturally, they don't run because other files are missing. He
is
hard headed and has more seniority than I do, so me telling him how to
install files is out of the question.
Jun 27 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by BPearson | last post: by
13 posts views Thread by Kevin Walzer | last post: by
7 posts views Thread by ashley.ward | last post: by
35 posts views Thread by keerthyragavendran | last post: by
reply views Thread by Atos | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.