Installing fonts with my application using C# - inno-setup

I am developing a project in C# where I need digital-7 font. Previously I have used InnoSetup for making my C# application files to setup files which could be install in any PC. I have never modified InnoSetup code.
I found this Link but I didn't understand anything. Somehow I tried a demo software where I added my font files like this
Source: "C:\Users\DEVJEET MANDAL\Downloads\digital-7\digital-7 (italic).ttf"; DestDir: "{fonts}"; FontInstall: "digital-7"; Flags: ignoreversion
Source: "C:\Users\DEVJEET MANDAL\Downloads\digital-7\digital-7 (mono italic).ttf"; DestDir: "{fonts}"; FontInstall: "digital-7"; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall
Source: "C:\Users\DEVJEET MANDAL\Downloads\digital-7\digital-7 (mono).ttf"; DestDir: "{fonts}"; FontInstall: "digital-7"; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall
Source: "C:\Users\DEVJEET MANDAL\Downloads\digital-7\digital-7.ttf"; DestDir: "{fonts}"; FontInstall: "digital-7"; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall
Source: "C:\Users\DEVJEET MANDAL\Downloads\digital-7\readme.txt"; DestDir: "{fonts}"; FontInstall: "digital-7"; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall
While installing I get this error
ADD FONT RESOURCE FAILED
I am totally new to this. Can anyone give some insight about this?

You could consider making use of Inno Script Studio for this issue.
Select Install Fonts... from the Project menu:
Then, select your fonts. For example:
The file(s) get added to the script for you at the location of the cursor. This should be in the [Files] section of your script. For example:
Source: "C:\Windows\Fonts\digital-7 (italic).ttf"; DestDir: "{fonts}"; FontInstall: "Digital-7 Italic"; Flags: onlyifdoesntexist uninsneveruninstall
Source: "C:\Windows\Fonts\digital-7 (mono italic).ttf"; DestDir: "{fonts}"; FontInstall: "Digital-7 MonoItalic"; Flags: onlyifdoesntexist uninsneveruninstall
Source: "C:\Windows\Fonts\digital-7 (mono).ttf"; DestDir: "{fonts}"; FontInstall: "Digital-7 Mono"; Flags: onlyifdoesntexist uninsneveruninstall
Source: "C:\Windows\Fonts\digital-7.ttf"; DestDir: "{fonts}"; FontInstall: "Digital-7"; Flags: onlyifdoesntexist uninsneveruninstall
It will get the FontInstall parameter correct which is your problem. See this question for reference.
You have given them all the same FontInstall value which is wrong. To quote the help:
Tells Setup the file is a font that needs to be installed. The value of this parameter is the name of the font as stored in the registry or WIN.INI. This must be exactly the same name as you see when you double-click the font file in Explorer. Note that Setup will automatically append " (TrueType)" to the end of the name.

Related

File not being unregistered by Inno Setup during uninstall when it is also matched by a wildcard Files section entry

I currently use the following code to install and register a DLL.
[Files]
Source: "Keys\Sentinel\*"; DestDir: "{app}"; Flags: recursesubdirs 32bit
Source: "Keys\Sentinel\hasp_com_windows.dll"; DestDir: "{app}"; \
Flags: regserver 32bit noregerror;
This works great during an install operation, and the logfile shows that the file has been successfully registered. My problem is that during an uninstall the file is not being unregistered, and the uninstall logfile contains nothing about the file other than that it has been deleted, which it has. What could cause the file to not be unregistered? The help file says it should be.
I can confirm the behavior you are seeing.
In general you should never install the same file to the same destination using two distinct entries in the [Files] section. That always leads to an unexpected behaviour. Like in this case.
The right solution is to exclude the DLL from the wildcard entry:
[Files]
Source: "Keys\Sentinel*"; DestDir: "{app}"; Excludes: "hasp_com_windows.dll"; \
Flags: recursesubdirs 32bit
Source: "Keys\Sentinel\hasp_com_windows.dll"; DestDir: "{app}"; \
Flags: regserver 32bit noregerror

Two or more functions are not working when they are used in a Check parameter

I have been trying to make work two functions in a Check. When I use more than one function none of them work. For example:
[Files]
Source: MyProg.exe; DestDir: "{app}"; Flags: ignoreversion; Check: portable and install;
Source: MyProg.dll; DestDir: "{app}"; Flags: ignoreversion; Check: portable and install;
Source: MyProg.ini; DestDir: "{app}"; Flags: ignoreversion; Check: portable and install;
When i only use one check portable or install, it works although i know that i can repeat the source Dir and place the other check like this:
[Files]
Source: MyProg.exe; DestDir: "{app}"; Flags: ignoreversion; Check: portable;
Source: MyProg.dll; DestDir: "{app}"; Flags: ignoreversion; Check: portable;
Source: MyProg.ini; DestDir: "{app}"; Flags: ignoreversion; Check: portable;
Source: MyProg.exe; DestDir: "{app}"; Flags: ignoreversion; Check: install;
Source: MyProg.dll; DestDir: "{app}"; Flags: ignoreversion; Check: install;
Source: MyProg.ini; DestDir: "{app}"; Flags: ignoreversion; Check: install;
But as I have many files, I want to use more than one function in one Check for not to be copying and pasting too many sources lines in the [Files] section.
This:
[Files]
Source: MyProg.exe; DestDir: {app}; Check: portable and install
is not identical to:
[Files]
Source: MyProg.exe; DestDir: {app}; Check: install
Source: MyProg.exe; DestDir: {app}; Check: portable
The first says install the file, when both portable and install are true/selected. What probably never happens.
While the latter says install the file, when either portable or install are true/selected.
So, you want to use or operator instead of and:
[Files]
Source: MyProg.exe; DestDir: {app}; Check: portable or install

Inno Setup + Node webkit app exe is not showing app icon in taskbar

I have created myapp.exe (the version of app that runs directly on double clicking) by binary copying myapp's code into nw.exe.
This myapp.exe runs with proper app icon in task bar.
However, when created installer through Inno Setup and then run the installed copy, it runs with default node webkits icon in taskbar.
Here is my script of Inno Setup:
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkedonce
[Files]
Source: "src\myapp.exe"; DestDir: "{app}"
Source: "src\myapp_nw_app2.exe"; DestDir: "{app}"
Source: "supportive_app.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "supportive_app.bin"; DestDir: "{app}"; Flags: ignoreversion
Source: "supportive_app\Redist\*"; DestDir: "{app}"; Flags: ignoreversion createallsubdirs recursesubdirs
Source: "src\Autorun.inf"; DestDir: "{app}"; Flags: ignoreversion
Source: "src\credits.html"; DestDir: "{app}"; Flags: ignoreversion
Source: "src\d3dcompiler_47.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "src\ffmpegsumo.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "src\icudtl.dat"; DestDir: "{app}"; Flags: ignoreversion
Source: "src\libEGL.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "src\libGLESv2.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "src\nw.pak"; DestDir: "{app}"; Flags: ignoreversion
Source: "src\pdf.dll"; DestDir: "{app}"; Flags: ignoreversion
[Setup]
AlwaysShowComponentsList=False
AppName=MyApp
AppVersion=0.0.1
AppCopyright=MyApp Inc.
PrivilegesRequired=none
AppId={{123456-29F0-43E1-9785-D71234554DDF9}
TimeStampsInUTC=True
DefaultDirName=C:\MyFolder\MyApp
UsePreviousAppDir=False
DisableDirPage=yes
AllowUNCPath=False
ShowLanguageDialog=no
AppPublisher=MyApp Inc.
AppPublisherURL=http://www.myapp.com
MinVersion=0,5.01sp3
CreateUninstallRegKey=yes
SetupIconFile=C:\MyAppInstaller\src\app_icon.ico
[Run]
Filename: "{app}\supportive_app.exe"; Flags: nowait
Filename: "{app}\myapp.exe"; Flags: nowait postinstall
[Icons]
Name: "{group}\MyApp"; Filename: "{app}\MyApp.exe"; WorkingDir: "{app}";
Can anybody tell what am I missing here?
I observed that the MyApp.exe which I created by binary merging my code with nw.exe, was having nw icon for file in explorer.
Through Resource Hacker (recommended by nw community itself), I changed that Icon to desired customized icon. Then I created the installer through Inno Setup and it started showing the same customized icon in taskbar when I run the installed copy of MyApp.exe.
Not sure if this is standard way for this problem.
I would appreciate if someone can guide me on this.
Thanks!
Yes, you’re meant to change NW.EXE’s icon with a program like Resource Hacker and the compile your program for the change to take effect. Inno setup then just zips all your stuff so it shouldn’t have any effect on your executables’ icon.
For future visitors;
The app icon and the icon on the taskbar are different. As stated previously in nwjs community and answers, you can use tool like resource hacker to change the .ico of the executable. But the icon that shows on the taskbar is actually picked up by package.json which should just be a standard png.
"window": {
"icon": "images/my-icon.png"
}

How to reference file from external folder so that it's still included in the installer package?

Here's what I'm trying to do:
Source: {%QTDIR}/bin/QtCore4.dll; DestDir: {app}; Flags: ignoreversion;
It doesn't unfold the QTDIR environment variable and gives me an error. It compiles and works fine if I add external flag, but I do need the file to be compiled into the installer package. Any way to achieve this?
Perhaps you could use ISPP #define?
Example:
#define MYCONSTANT GetEnv("USERPROFILE")
[Files]
Source: "{#MYCONSTANT}\myfile.txt"; DestDir: {app}; Flags: ignoreversion
I'm linking to UserProfile here as an example, but you can define QTDIR there if it is set as system constant %QTDIR%.
Probably:
#define QTDIRCONSTANT GetEnv("QTDIR")
[Files]
Source: "{#QTDIRCONSTANT}\bin\QtCore4.dll"; DestDir: {app}; Flags: ignoreversion

Inno Setup : Exclude a directory and its files also

I use the "Exclude" flag in Inno Setup in order to exclude from installation a subdirectory name "Bin32" or "Bin64" depending on the user's architecture.
All I want is to NOT install the useless folder and ALL its files and subdirectories as well.
Here are my current rules:
[Files]
Source: "Z:\Work\temp\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; Exclude
Source: "*"; Excludes: "\Bin64"; DestDir: "{app}"; Flags: recursesubdirs; Check: not Is64BitInstallMode
Source: "*"; Excludes: "\Bin32"; DestDir: "{app}"; Flags: recursesubdirs; Check: Is64BitInstallMode
First, I don't quite understand what the "*" stands for at the beginning of the excluded rules ?
Second, it works fine with all subdirectories inside Bin32/64 folder but the files are still been installed and I can't figure out a way to not install them...
Thx.
Each entry is a single operation and is not effected by any other entry. With that in mind, this is what happens:
The first line installs everying from z:\work\temp.
The 2nd line, if in 32-bit mode, installs everything from SourceDir except \Bin64
The 3rd line, if in 64-bit mode, installs everything from SourceDir except \Bin32
I expect that your SourceDir (the script path if not specified) is the same as Z:\Work\Temp and as such, you essentially end up with everything installed anyway.
If you duplicate the first entry, and move the Excludes (without the \ prefix) and Check parameters onto it, it should work as you require:
[Files]
Source: "Z:\Work\temp\*"; Excludes: "Bin64"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: not Is64BitInstallMode
Source: "Z:\Work\temp\*"; Excludes: "Bin32"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: Is64BitInstallMode

Resources