How do I publish a Windows Forms Application?
Asked Answered
A

4

21

So I made a C# program, and its great and all (its a Windows Form Application). The issue with it, is I don't know how to use it outside of the debug mode form. How do I publish it? My target goal is to create a two folders, put a shortcut to the application in one, along with the other folder which will contain the application and all outside programs (some of the buttons link to batch files). Then I'd want to be able to put it in a RAR compressed file, and upload it online for others to download it.

How do I publish it so that happens? How do I take it out of debug mode?

Amphibious answered 22/5, 2011 at 1:14 Comment(4)
That's not very wize to create you own update/download/maintinance solution for every platform, dot net framework does, unless you are using ClickOnce technology. I will teach you how to do this, if you change you question accordinglyTyler
If you will be using ClickOnce, you will be able to update your application automatically to the clients, as well as override, if needed, (for example, to call some batch before actual update of files using spwned processes, notify users for available updates, and such) distribution logic of your application using ClickOnce technologly. You will be able to publish your updated versions directly from your building environment.Tyler
Additionally, ClickOnce thechnology is avalible on almost any web distrbution platform, either ASP.NET IIS or PHP Apache or Mono. Also it can build updateable CD distributions or for a network share.Tyler
Do you want to make a setup for your project ?Hudspeth
P
28

Go into your project folder, then navigate to /bin/Release. If there's an EXE file with the title of your project in there, copy it somewhere (along with any DLLs that you may have linked) and there's your program. If it's not there, first try Build -> Compile Solution in Visual Studio. If it's still not there, navigate instead to /bin/Debug and do the same thing. Then, copy all your batch files into another folder, put them into the same folder, and RAR it.

P.S. Try not to use RAR, few people can extract them. Use ZIP or SEA (self-extracting archive) if at all possible.

Prakash answered 22/5, 2011 at 1:16 Comment(4)
I downvoted your answer because you suggested RAR-ing the output in the Debug directory. You shouldn't ever distribute a debug version of the application unless you have a specific reason to do so.Dehnel
@Jacob: Well, yes, but ZIP functionality is built-in to Windows, Mac, and Linux. You have to install WinRAR, and some people with limited permissions can't do that. Of course, if your program needs such permissions to run, then it doesn't matter. @Chris Fulstow: Thanks :)Prakash
Ok - now your answer is sufficient, nice job. +1 And yes, I know that the actual code is not in the debug version, however there are other minor points that make a debug build less advantageous for distribution.Dehnel
I suppose there is a much better solution than that one, and, additionally, use of static liked DLL's sometimes is not enouth to build modern application, (for example extensible ones, using MEF, of Unity as containers)Tyler
D
19

First off, you need to build your application in Release mode, in Visual Studio simply change the drop down near the top of the window to "Release." This will create a bin/Release directory where your sources are located. The folder will contain an EXE for your application and DLLs you need to include. It could (and probably will) include some debugging *.PDB files that you do not want to include -- as those include debugging information.

Copy the contents of that directory somewhere and RAR it up.

Building in x86 Mode

(You should only do this if you have a specific reason to)

If your application uses 3rd party DLLs that are not 64-bit compatible, you may need to do a release build in x86 mode. To do that, click the "Any CPU" drop down and click "New Configuration" (or something like that) and follow the steps to add x86. Then build with the x86 -- Release setting. That will output x86 binaries to a bin/x86/Release folder where your sources are located.

The Preferred Soltuion

Most users are going to prefer some form of automatic installer instead of a simple RAR or ZIP. Visual Studio (Standard/Pro) can create self installing MSIs that do all the work for you. A basic overview is here. You can add shortcuts/etc using the wizards Visual Studio provides.

If you need an even more robust installer you could check out solutions such as InnoSetup or NSIS

Dehnel answered 22/5, 2011 at 1:27 Comment(1)
By using ClickOnce you will avoid of DLL hell, actually.Tyler
B
7

To build your application in Release mode instead of Debug, go to the Build menu and select Configuration Manager.

Change the Active soluction configuration to Release. Now, when you build your solution, it will put the executable in the /bin/Release folder.

If you need to automatically perform certain actions once the solution is built, like packaging into a RAR or ZIP archive and copying the distributable to another folder, then check out post-build actions.

Boudreaux answered 22/5, 2011 at 1:29 Comment(2)
If user override the default output path and target platform, or compile on a different development platform, the specified path might be invalid and targeted to a specific version on an application, for example, defatult output path can targets to (bin\x86\Debug, bin\x64\Debug, <custom user path>)Tyler
@Artur true, but there's no mention of multi-architecture builds in the question, so this isn't a consideration.Boudreaux
B
-1

After Visual Studio 2010 , Microsoft remove Make setup utility facility from the visual studio and,we have to downlorad that plugin seperatly from

Get InstallShield Limited Edition for Visual Studio

You Have to fill the application

After intalation, goto Visual Studio-->New Project-->Other Project type-->Setup and Development

You will see follwing screen

enter image description here

Now you can goto InstallShield setup utility and change the things as you requirement.

enter image description here

add all file in debug folder of your project in follwing interface and build solution,

Final setup will locate in your setup folder-->Express\CD_ROM\DiskImages\DISK1**

hope this will help you

Bountiful answered 6/4, 2017 at 11:1 Comment(1)
Do you seriously mean that he should build the solution from the Debug files?!Rm

© 2022 - 2024 — McMap. All rights reserved.