Single File Exe

  • Thread starter Thread starter jp2msft
  • Start date Start date
J

jp2msft

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.
 
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
 
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")?
 
jp2msft said:
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 :)
 
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.

--
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top