Error running .exe file in Inno setup - inno-setup

I am trying to make my script run this file:
http://www.microsoft.com/en-us/download/details.aspx?id=40779
before/after (doesn't matter) I install my application.
This is my script:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
; Flags: skipifsilent
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{AEDD3A70-5044-452B-B78D-9CCE4E130654}
AppName=Pong
AppVersion=2.0
;AppVerName=Pong 2.0
AppPublisher=Roymunson_Studios
AppPublisherURL=http://www.example.com/
AppSupportURL=http://www.example.com/
AppUpdatesURL=http://www.example.com/
DefaultDirName={pf}\Pong
DefaultGroupName=Pong
AllowNoIcons=yes
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
[Run]
Filename: "{app}\Installers\NDP451-KB2858728-x86-x64-AllOS-ENU.exe"; StatusMsg: "Installing .NET Framework 4.5.1"
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
Source: "C:\Users\vroy\Desktop\Debug\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{commondesktop}\Pong"; Filename: "{app}\Pong.exe";
However when it tries to compile the .NET 4.5.1 installer file it shows the following error:
"The process cannot access the file because it is being used by another process"
This makes no sense because the .NET 4.5.1 installer is not being used when I am compiling my Inno script.

Related

How to override a third-party installation directory with inno setup

I need to install a thirdparty software embedded in a installer named thirdparty-installer.exe and also install my application Instruct.exe. My application will be at c:\MyAPP folder and all my thirdparty files must be at c:\windows\system32 (all files will be thrown there, in the system32 root). I have done the following:
#define OutputDirectory_MPP "c:\myAPP"
[setup]
DefaultDirName=c:\MyAPP
DisableDirPage=yes
[dirs]
Name: {#OutputDirectory_MPP}; Attribs: system
[files]
Source: "g:\application\Instruct.exe"; DestDir: {#OutputDirectory_MPP}
Source: "g:\applicationr\thirdparty-installer.exe"; DestDir: "{cf}"; Flags: ignoreversion recursesubdirs createallsubdirs promptifolder; Permissions: system-full;
[Run]
Filename: "{cf}\thirdparty-installer.exe"; Flags: shellexec waituntilterminated
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
(...)
My Instruct.exe installs normally, and when it finishes, the thirdparty-installer prompts and show the user the option to change installation directory. Their default is c:\program files\Thirdparty2020\
How can I impose their installation to be on the c:\windows\system32 folder and leave no option to the user? (possibly even coupled with a silent install).

Inno Setup will not create folder under C:\Users\Public - will instead do C:\Users\Public\Public Documents

I am using Inno Setup to build my installer and I have the C:\Users\Public folder hardcoded in my [Files] section to place some files (Inno Setup does not have a constant for this folder)
My goal is to have the install create a C:\Users\Public\MyApp folder with some files in it. However when I run the install, it is creating the folder here:
C:\Users\Public\Public Documents\MyApp
Is this a permissions issue where the installer doesn't have access to create a folder directly under C:\Users\Public?
[Files]
Source: "MyApp\db.mdf"; DestDir: "{drive:{src}}\Users\Public\MyApp"; Flags: ignoreversion;
I cannot reproduce your problem. For me your code works. I've tested it on Windows Vista, 7 and 10. It always installs to C:\Users\Public\MyApp.
Though I do not understand the {drive:{src}}. How does the drive of the Users folder relate to the drive of the installer? You should use the {sd} constant:
[Files]
Source: "MyApp\db.mdf"; DestDir: "{sd}\Users\Public\MyApp"; Flags: ignoreversion
But anyway, to resolve the path to the C:\Users\Public, you can use the PUBLIC environment variable:
[Files]
Source: "MyApp\db.mdf"; DestDir: "{%PUBLIC}\MyApp"; Flags: ignoreversion
It works since Windows Vista.
Alternatively, you can use SHGetKnownFolderPath with FOLDERID_Public. For an example code, see Constant for AppData\LocalLow?
If you need to support even Windows XP, where there is no C:\Users\Public folder or PUBLIC variable, you have to find out, what path your need to use there instead (probably C:\Documents and Settings\All Users), and implement a fallback using a scripted constant:
[Files]
Source: "MyProg.exe"; DestDir: "{code:GetPublicPath}\MyApp"; Flags: ignoreversion
[Code]
function GetPublicPath(Param: string): string;
begin
Result := GetEnv('PUBLIC');
if Result <> '' then
begin
Log(Format('PUBLIC is "%s"', [Result]));
end
else
begin
Result := GetEnv('ALLUSERSPROFILE');
Log(Format('PUBLIC is not set, ALLUSERSPROFILE is "%s"', [Result]));
end;
end;
And for others, it's worth noting that your need for resolve C:\Users\Public is very specific, related to this question: C++ app MDB in ProgramData copies to user's AppData folder when I dont want it to.
One usually does not want the C:\Users\Public, but C:\Users\Public\Documents (= {commondocs}) or C:\ProgramData aka C:\Users\All Users (= {commonappdata}).

Inno Setup automatic deletion of read only folder on uninstall

I have a simple app that copies some folders and files in C:/ directory with attribute READ ONLY. I did it well. But my problem is when I try to uninstall the previous version and install the new version, this folder did not remove because attribute is set read only. What i want to do is
1-when user install the app I want inno setup check if the app already installed or not
2-uninstall the previous first and then install the new version.
I must set attribute read only for this folders and files.
[Files]
Source: "D:\POS CAD Standard\acad.lsp"; DestDir: "{userappdata}\Autodesk\AutoCAD 2014\R19.1\enu\support";
Source: "D:\POS CAD Standard\CAD\*"; DestDir: "{sd}\POS CAD Standard"; Flags:recursesubdirs createallsubdirs; Attribs: readonly hidden system;
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[dirs]
Name: "{sd}\POS CAD Standard";Attribs: readonly hidden system;
[Icons]
Name: "{group}\{cm:UninstallProgram,ALstom POS CAD Standard}";Filename: "{uninstallexe}"
Use uninsremovereadonly flag.
And as you have found yourself already, use also overwritereadonly flag to allow upgrade.
Source: "D:\POS CAD Standard\CAD\*"; DestDir: "{sd}\POS CAD Standard"; \
Flags: recursesubdirs createallsubdirs uninsremovereadonly overwritereadonly; \
Attribs: readonly hidden system;

Replacing a file whose file name changes every release with Inno Setup

I am creating an installer using Inno Setup and I have a file whose name changes every release (because the file name has the version number embedded in it):
#define MY_FILE_NAME "file_1.0.0.jar"
[Files]
Source: {#MY_FILE_NAME}; DestDir: {app}; Flags: ignoreversion
How would I make my installer remove file_1.0.0.jar from the install location when installing file_2.0.0.jar?
I added an [InstallDelete] section which seems to do the trick:
[InstallDelete]
Type: files; Name: "{app}\file_*.jar"

Read me file with Inno Setup

I am programming my Inno Setup Compiler that I was asking about earlier but had encountered a problem . How do I let the Installer add a Read me File?? I am using Inno Setup Compiler 5.5.3 and uses the following command "AppReadmeFile=C:\Users\Cordre\Desktop\D_C Databasis Tools\Read me.txt" in Inno but if I install the program their is no Read Me file in the Program files.
The text document does exist and is called correctly double checked that.
Is their any other command that I also have to use?
From the documentation on AppReadmeFile:
This string, which may be a URL, is displayed on the "Support" dialog
of the Add/Remove Programs Control Panel applet in Windows 2000/XP and
later. The value may include constants.
This directive has nothing to do with a README file in the Program Files directory. If you want a copy of the README in the Program Files directory, you'd need to add it to the [Files] section. For example:
[Files]
Source: "MyReadme.txt"; DestDir: "{app}"; Flags: ignoreversion
You can also add an icon to the file using the [Icons] section. According to the documentation, a sample Icons entry would be:
Name: "{group}\My Program"; Filename: "{app}\MYPROG.EXE"; WorkingDir: "{app}"

Resources