The project will be added to the solution. Now open the file system editor by clicking on the project and select the option to open the file system editor, as shown in the following figure. Right-click on the Application Folder and add an output project the output project specifies the project we are creating an installer for, like in the following figure: You'll get to see the Application Folder, User's Desktop and User's Program Menu. Select "CreatingInstaller", in other words the Windows application project name in the "Add Output Project Group" window, select it as the primary output as shown below and click "Ok". ![]() The Primary output will be added as shown below, having a type defined as Output. In the meanwhile let's add some more functionality to our Windows application, let's read a file and show its output in a message box on button click. Therefore just add a text file, I called it Sample.txt to the "bin\debug\Input" folder, Input is the custom folder I created to place my txt file. Write a few lines of code just to read the txt file from the Startup path, in my case "bin\debug". It could also be "bin\release" as per the project build, and specify the file folder name and file name to read the content. I chose to keep my txt file at the startup path so that I could explain how to create files and folders at the time of installation. ![]() Now we also need this Input folder and a Sample.txt file at the time of installation to be located at the location of the installed application.įor file operations I added the namespace System.IO, needless to specify this thou. Therefore running the application will show two message boxes, one after another showing the text box text and text from the Sample.txt file. Now in this folder creation logic has to be implemented in the out setup project, so that when the application installs, it has all the pre-requisites required to run the application, like the Input folder and the Sample.txt file. So, right-click on the Application Folder in the File system editor and add a folder. The folder will be created just below the Application Folder, name that folder Input. Right-click on the folder, select properties and mark Always Create property to True. That means the folder will always be created whenever we run the installer, after a fresh build release. Add an icon to the form like in the following figure: You can decorate your form to add an icon to it, that icon will also be required at the time of installation to create a shotcut icon to our application. It is now time to add the Sample.txt file. Right-click the Input folder created and Add file to it, browse for the Sample.txt file in the Windows Application project we created earlier. ![]() To create a shortcut to the application, right-click on the Primary output in the middle window pane and select "Create Shortcut to Primary Output", name that shortcut as CreatingInstaller. Select the properties of the shortcut by right-clicking it and add an icon to it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |