Link to home
Start Free TrialLog in
Avatar of Member_2_1242703
Member_2_1242703

asked on

Including files as part of a Windows forms executable

I have a Windows forms application. Part of what it does is copy 2 files. Is there a way I can include these files in the executable without having an installer?
Avatar of John
John
Flag of Canada image

You could perhaps ZIP your files up and distribute. Then unzip the files and programs. I see a lot of this.
ASKER CERTIFIED SOLUTION
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Not saying that Shaun's recommendation is a bad one because I have done this myself.  However, understand that if the files required by the executable change; e.g. - new version released; you will have to rebuild your assembly in order to update the files.  This can also be true in the case that John mentions as well.

However, with John's method, you can build your executable in such a way that you can get by with just redistributing the dependencies.  With the recommendation by Shaun, you *have* to rebuild your assembly.

-saige-
can include these files in the executable without having an installer
@Shaun, don't get me wrong, I get it.  It's what the author asked for.  But you still want them to know about any potential issues they may not have thought of.

-saige-
With the recommendation by Shaun, you *have* to rebuild your assembly.
Not necessarily...depending on what you consider to be the assembly**. One could compile these supplemental files into a DLL--i.e. a 2nd assembly--and only have to recompile that. The main executable could handle the execution of this DLL, and the DLL can be responsible solely for what it knows about--i.e. the two files--and the main executable doesn't change. It simply invokes the DLL as it always does, and the DLL takes care of the files.

Another possibility, perhaps less permissible by environment, would be for the application to download the files from a server at launch.

** Yes, I understand that I'm still suggesting that something gets recompiled. But you can minimize what has to be recompiled.
without having an installer
Implies not an archive
Avatar of Member_2_1242703
Member_2_1242703

ASKER

Thanks everyone. In this particular case, I'll only be running the program once per machine then it's over for good, so this solution is probably the best. It does work great too. Thanks Shaun and everyone else for the input!