I am using Inno Setup to create an installer of my application.
On the first run my application is creating an SQLite database but it can't achieve that while the user doesn't have the permission of modify the installation folder.
I managed to set permissions of files:
[Files]
Source: "D:\....\***.jar"; DestDir: "{app}"; \
Flags: ignoreversion; Permissions: users-full
Source: "D:\....\*"; DestDir: "{app}"; \
Flags: ignoreversion recursesubdirs createallsubdirs; Permissions: users-full
But that doesn't help because I need full users permission on installation folder, for example: C:\Program Files\InstallationFolder
The Permissions parameter of the [Files] section entry applies to the installed files only, not to the implicitly created directories.
To change permissions of a folder, use an explicit entry in the [Dirs] section for the {app}:
[Dirs]
Name: {app}; Permissions: users-full
Though it is not a good practice.
In general, Windows applications shall not require write permissions to their folder. That's against Windows guidelines. The application should write data to a user profile folder (C:\Users\username\AppData) or to a common data folder (C:\ProgramData).
See also Application does not work when installed with Inno Setup.
In your specific case, you better run the database creation process as the Administrator (e.g. using the runascurrentuser flag).
Related
This question already has an answer here:
How to set permissions of installation folder in Inno Setup
(1 answer)
Closed 18 days ago.
I have an Inno Setup installer which copies some files into Program Files, the [Files] section is set up like this:
[Files]
Source: "Bundled_Files\*"; DestDir: "{commonpf64}\StudioLinked\Romplur\"; Flags: ignoreversion recursesubdirs createallsubdirs; Permissions: users-full;
The files copied from inside Bundled_Files always end up being set to read-only. I've set the permissions to users-full but that doesn't seem to change anything. Is there a way to ensure that files are made NOT read-only?
I tried adding an additional [Dirs] section before the [Files] section like so:
[Dirs]
Name: "{commonpf64}\StudioLinked\Romplur\"; Permissions: users-full;
But this also didn't change the read-only setting on the folders.
Using Inno Setup 6.2.1 on Windows 10. Any help appreciated!
I use the following code to make a subdirectory of my installation directory writable and editable:
[Dirs]
Name: "{app}\MyWritableSubDir"; Permissions: users-modify
However, you should store only data files in any writable directory or sub-directory of "C:\Program Files", never executables: Otherwise this opens a security hole (there is a reason why "C:\Program Files" is read-only for normal users!).
The correct place to store application specific data, as intended by Microsoft, is either the ProgramData directory or the AppData directory. See Where is the correct place to store my application specific data? for a more general discussion.
See https://jrsoftware.org/ishelp/index.php?topic=consts how to use these directories in Inno Setup.
When I want to delete my application (that was installed through an installer with Inno Setup), anything related to it should be removed from my drive.
So my goal is to also delete a temp folder that was created at runtime by my application.
Unfortunately, this line of code was not able to solve my problem
[UninstallDelete]
Type: filesandordirs; Name: "{tmp}\MyTempFolder"
I get this error message in the Debug Output:
Failed to delete directory (145). Will retry later.
I am building DacPac file from a database project using Visual Studio. Also, in the Debug Drop tab in Advanced Build Settings, I enabled the following options:
Do not drop credentials
Do not drop database roles
Do not drop database scoped credentials
Do not drop logins
Do not drop permissions
Do not drop role membership
Do not drop users
Do not drop server role membership
Still, I get the following error in CD SQL Deploy:
EDIT
based on the advice of Krzysztof Madej, I have put the following additional arguments (they were working on another project), but for the argument, he proposed and for these ones I got this error:
is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
In AdditionalArgument you have to add
/p:BlockOnPossibleDataLoss=false
But be aware that will delete you data.
If you use classic release it will be here:
in yaml
- task: SqlAzureDacpacDeployment#1
displayName: Execute Azure SQL : DacpacTask
inputs:
azureSubscription: '<Azure service connection>'
ServerName: '<Database server name>'
DatabaseName: '<Database name>'
SqlUsername: '<SQL user name>'
SqlPassword: '<SQL user password>'
DacpacFile: '<Location of Dacpac file in $(Build.SourcesDirectory) after compilation>'
additionalArguments: '/p:BlockOnPossibleDataLoss=false'
I have an application to pack into a setup file with Inno setup. Application must work as a service on Windows. I am using NSSM service manager to get it done in single computer. However in Inno setup package, I couldn't find any trick to make it possible.
Is there anything to do it with NSSM or is it possible to make service working with Inno script?
Download NSSM
Extract Zip file, then copy nssm.exe to your source path (which Inno Setup script get sources from).
Create a bat file to allow nssm set your App as a service as below:
nssm install "ServiceName" "YourAPP.EXE"
nssm set "ServiceName" AppDirectory %CD%
nssm start "ServiceName"
del "%~f0"
Note: del "%~f0" to delete bat file after setup finished, if you don't want that, remove that line from bat file
Add the previous bat file in your source path.
Add new sources to Inno Setup script as below:
[Files]
Source: "..\YOUR-SOURCE-PATH\file.bat"; DestDir: "{app}";
Source: "..\YOUR-SOURCE-PATH\nssm.exe"; DestDir: "{app}";
Add bat file under [Run] section to set service and start your app as below:
Filename: "{app}\file.bat"; \
Flags: nowait postinstall hidewizard runhidden runascurrentuser; \
Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"
I hope it be useful, have to thank #MartinPrikryl
We are creating an application that updates it's files under Program Files - we've run into some permission errors and were starting to wonder who should be owner of files - the "SYSTEM" user or the one that installed the software? After inspecting the "Program Files" folder we see that some software binaries have the user as owner, some "SYSTEM". We are failing to overwrite some files and the only weird thing seems to be that the owner of our updater binary is the "SYSTEM" user.
Is always better to install apps that needs write permissions in a folder under C: or you can look at ntfs permissions on that folder and add your users.