Skip to content
⌘ NSIS Forum Archive

Newbee Question(s)

5 posts

JeroenJA#

Newbee Question(s)

Hi all,

I have developed an desktop application with VS2012 Pro. Language = vb.net.
I also have a licensing system which requires to be referenced, a .dll
I have another .dll that is required for the application to run and I have some template files that I would like to include in my package. At the moment the app is available on the market and all works like a treat, but......

I have used VS OneClick to publish the app. My app gets installed somewhere on the user's computer (where I personally don't want it to be) and when that is done my app is downloading the templates files from the server; I don't now how to add those files in the deployment / setup. I am not 100% happy with this solution.

In the control panel the uninstall icon is the standard ugly VS icon, not the beautiful icon of my app; so unprofessional in my opinion.

Someone has referred me to NSIS and I have downloaded it and tried some samples. It looks like it does what I am looking for. I can get the templates where I want and the uninstall icon can be the icon of the app. There are certain things I would like to modify but for now that is fine.
With creating my own install package I have used the published setup.exe of my app, a .rtf and the .ico just 3 files as described in 1 of the examples on the website. Found a mistake in it but was able to solve it by looking at another example.
At this stage I am able to create an installer that puts the templates in the right folder and I can have the setup of my app executed. This creates 2 uninstall icons in the control panel, 1 ugly icon and 1 very nice icon.


Now the bits I do not understand and the related questions.

When I (re)build my solution I see lots of files in the release folder.
Not understanding what OneClick does with these files the following question:
Now I would like to build an installer with the following 'Package':
- DIR1: a directory with the necessary files of my app
- DIR2: a directory with the templates
- DIR3: a directory with some other files
- The installer.exe

Q1: I am assuming that all the files from the release folder need to be copied into DIR1 - Is this assumption correct? (Why am I not trying it? Well, I have installed it so may times I don't know if it would still read .dll files or other files that I don't know where they are.)

Q2: If my Q1 assumption is correct then I only have to call the app.exe for my app to run, correct? (I am asking this because there is also a myapp.application and that wants to install my app)

Q3: If my Q1 assumption is not correct what am I supposed to do?

Q4: Do I need to put the .dll files in a particular directory or not, or what is wise?


Many thanks for your time in this, much appreciated

JJ
JasonFriday13#
Originally Posted by JeroenJA View Post
With creating my own install package I have used the published setup.exe of my app, a .rtf and the .ico just 3 files as described in 1 of the examples on the website. Found a mistake in it but was able to solve it by looking at another example.
At this stage I am able to create an installer that puts the templates in the right folder and I can have the setup of my app executed. This creates 2 uninstall icons in the control panel, 1 ugly icon and 1 very nice icon.
I have never heard of VS OneClick, but a quick search tells me that it's basically an installer system. And what you've done is create a double installer that's chain-linked (which is why you're getting two uninstall icons).

Basically, use one or the other, but not both.

Originally Posted by JeroenJA View Post
Now the bits I do not understand and the related questions.

When I (re)build my solution I see lots of files in the release folder.
Not understanding what OneClick does with these files the following question:
Now I would like to build an installer with the following 'Package':
- DIR1: a directory with the necessary files of my app
- DIR2: a directory with the templates
- DIR3: a directory with some other files
- The installer.exe

Q1: I am assuming that all the files from the release folder need to be copied into DIR1 - Is this assumption correct? (Why am I not trying it? Well, I have installed it so may times I don't know if it would still read .dll files or other files that I don't know where they are.)

Q2: If my Q1 assumption is correct then I only have to call the app.exe for my app to run, correct? (I am asking this because there is also a myapp.application and that wants to install my app)

Q3: If my Q1 assumption is not correct what am I supposed to do?

Q4: Do I need to put the .dll files in a particular directory or not, or what is wise?


Many thanks for your time in this, much appreciated

JJ
Unfortunately, as the developer you should be able to answer these questions. I'll give you some guidelines on creating installers.

The installer should have everything that's needed for the program to run, this includes the program executable, dll's, and other files required for the program to work. For smaller scale software, it's fine to put all the required files into one directory (with extra sub-directories if needed). Generally it's: "$PROGRAMFILES\Name Of Your Program". So the nsis command will be: InstallDir "$PROGRAMFILES\Name Of Your Program".

In a section, this directory is put into a variable called $INSTDIR. To create the directory, this is the command: SetOutPath "$INSTDIR". Then you add files using the File command. Here's a basic example:
!define NAME "Your Program Name"
Name "${NAME}"
OutFile "${NAME}-Setup.exe"

InstallDir "$PROGRAMFILES\${NAME}"

; these will be different if you're using MUI2.
Page Directory
Page InstFiles
UninstPage uninstConfirm
UninstPage InstFiles

Section Install

SetOutPath "$INSTDIR"
File "required_file1.exe"
File "required_file2.dll"
SetOutPath "$INSTDIR\images"
File "required_file3.bmp"
File "required_file4.bmp"

WriteUninstaller "$INSTDIR\uninstall.exe"

SectionEnd

Section un.Install

Delete "$INSTDIR\required_file1.exe"
Delete "$INSTDIR\required_file2.dll"
Delete "$INSTDIR\images\required_file3.bmp"
Delete "$INSTDIR\images\required_file4.bmp"
Delete "$INSTDIR\uninstall.exe"

RMDir "$INSTDIR\images"
RMDir "$INSTDIR"

SectionEnd
There is a lot more to it for a proper software install, such as writing registry entries, creating shortcuts, and other more complicated stuff if it's needed. I often use NSIS as a script language to automate tasks with files and other stuff (a 0 to 255 generator that writes to a file was a recent one).
JeroenJA#
Jason as developer I should know but I don't (thanks for the slap in the face), that's why questions were invented. Most newbies, I am one of them, don't know all the answers. I am not looking for guidelines, the NSIS examples which came with the installation and examples on the website are very good reference materials. The only thing I am after are the answers to my questions, that's all.
JasonFriday13#
I didn't know what your software is and what it requires, so I just made a general guide to cover the bases. I've written several plugins for nsis and worked on the source code, but I haven't actually developed any software for release with an installer (apart from my custom UI for nsis).

Glad you got it sorted 👍.