I have per user installation.
Application will be installed to user's AppData directory.
There is following warning during build of wxs file:
warning LGHT1076 : ICE91: The file 'app.exe' will be installed to the per user directory 'INSTALLDIR' that doesn't vary based on ALLUSERS value.
This file won't be copied to each user's profile even if a per machine installation is desired.
What does it mean that file won't be copied to user's profile?
As I can see my application is isntalled without any problems. File is installed to user's AppData directory.
Normally, when you install a file to a user profile location and another user uses the app in a per machine install, you want all the files there. Otherwise you have an app that works for the installing user (because the file is there in the user profile folder) but it won't work for other users because the file is missing. If the MSI file was built "correctly", another user would log on, use a shortcut (for example) and Windows would notice the missing file and install it, therefore every user account (even those that are not yet created) will get a copy of the file in their user profile folder. If you're doing a per machine install and you want every user (not just you!) to get a copy of the file you should fix it.
CE91 posts a warning if a file, .ini file, or shortcut file is
installed into a per-user only directory. These warnings are harmless
if the package is only used for installation in the per-user
installation context and never used for per-machine installations.
You may wanna take a look into the docs.
If you want to suppress that warning msg take a look into this SO
Related
I have a per-machine WiX installer (InstallScope="perMachine" InstallPrivileges="elevated") and I need to create a folder and copy a few files to the Documents folder of each user running the application. At the moment I install the files to a personal folder of the current user, but that's wrong and I get the ICE91 verification warning:
ICE91: The file 'SomeFile' will be installed to the per user directory 'SomeDir'
that doesn't vary based on ALLUSERS value. This file won't be copied to each
user's profile even if a per machine installation is desired.
I want the files to be automatically copied to the Documents folder of each user. Could someone post the step-by-step instructions how to do that?
UPDATE: I will be on holiday until September, during that time I will not be able to respond to any comments.
Windows Installer will do this - it's what advertised shortcuts will do. If you install a file to a user specific folder location and a different user logs on, then that file will be missing for that user and repair mechanism of the advertised shortcut repair will install it from the original MSI file. In your case the PersonalFolder property is the user's Documents folder.
To arrange this, the file must be the keypath of a component, and that component must be in a feature with an advertised shortcut. When the shortcut is used the component and containing feature are checked for "self healing" and the missing file installed. This works for users that don't yet exist. Older Office installers once did this to install user-specific items such as templates.
The MSI must obviously be available for this to work, and there is no mechanism to remove the files at uninstall time.
An alternative (or if there are no advertised shortcuts) is to add code to the app that calls MsiProvideComponment (or equivalent p/invoke) passing the ProductCode, feature name, Component id (of that documents file) and use INSTALLMODE_DEFAULT, which will install the file if it's missing as documented here:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa370356(v=vs.85).aspx
and it will be missing and therefore will be installed for a user who has not run the app before.
Why would you want to do this this way? What if there are 10000 (just for example) users on the machine? You want to copy the files to all 10000 documents folders taking up potentially GBs of space (depending on the size if the files copied)? If these are configuration options needed by your app, the app itself should create default files in the user's documents location on the first run if they are not present otherwise load the settings from these files. You should not put the default files there for every single user on the machine at install time.
This approach also fails for new users added after you install. How will they get the files in their documents folder? Do they have to reinstall the product?
Consider a per machine install of per user installers with shortcuts that interested users could launch. For example, templates.msi, examples.msi.
I created an application that is installed from the setup file which installs all the files required by the program. When I update the application, I can only share the exe files of the update application to the user and not the entire installation package/setup file(not possible due to constraints)(Reason: so that he can run the application with out me having to make a new installation package/setup file and user having to install from the setup file) I am unsuccessful in my attempts so far. Can any one suggest if this is possible or if I am doing something wrong?
P.S : I have added the manifest file with privilege of always working as an administrator with out which I am unable to run my base application ( Error : Access to the path c:/xxxx/Tnsnames.ora denied)
Manifest file is the answer.
Manifest file is a file in VB project which contains the information
about the contents of file distribution. It may contain checksum or
hash to verify that file is original and isn't modified in any way.
Modifying a file will change its checksum value.
You need to replace asInvoker with requireAdministrator or highestAvailable
Updated link:
Full tutorial
I would like to delete file (that was created by pyinstaller in C:\Users\User\AppData\Local\VirtualStore\Program Files (x86)\App\tmp )
during Uninstall (using WiX). Any idea on how to do that?
Does anybody know why pyinstaller creates that file and if I can control that?
A partial answer: That virtual store location is where Windows redirects file output when the program is not privileged enough to write to a location, and does not have an elevation-type manifest that shows it is UAC-aware. This might help:
http://sourcedaddy.com/windows-7/uac-virtualization.html
So it appears that pyinstaller assumes it is being run as administrator, but it isn't, and is writing to a location that's virtualised. Instead of trying to remove those files I'd look at that installer and how you are running it and (since it seems to require admin privilege) how to have it run with admin privilege. I assume it's old technology because an updated version would presumably include an elevation manifest saying that it requires admin privilege.
I'm creating a WIX installer for a C# application.
In the application I use System.Configuration.ConfigurationManager.AppSettings[Setting1] to get settings.
My question is, where must I place the program.exe.config file on the machine in order for it to work?
I can't place it with the program in ProgramFiles directory, since those files are read-only.
I tried:
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
config.AppSettings.Settings[Config1].Value = "Value1";
config.Save();
Unfortunately I don't know where it's looking.
Thanks your replies, Trevy
It should be in the same folder of the program.exe. Use wix to copy both program.exe and program.exe.config to the required folder.
If you need to edit the configuration file during the installation you will need to do it using a custom action in wix. Make sure you pass the file path to the custom action and write the code to read the configurations in that file and edit.
The problem isn't that the files there are readonly - the problem is that you are trying to update files in the Program Files folder with your config.Save, and you can't do that if you are a limited user, and you are always limited (even if you are admin) unless you elevate. The short answer is that:
If your app routinely updates files in restricted areas then it probably needs elevation, so give it an elevation manifest.
If however you require you app to be used by limited users and allow them to update that config file then don't install to Program Files. Choose User Appdata folder, for example. Windows is probably using your config file during program startup, so you can't separate it from the exe.
When I was creating an installer for my app, I found I couldn’t save my settings.
The reason is because the Program Files repository, from a practical point of view, is read-only (Applications should never run with elevated permissions). When installing a program, the only time we modify the MyApp.exe.config file is at installation/upgrade/repair time.
The config file has many sections. One of them is userSettings. This is where we store any data we need to modify during the lifetime of the application. When run for the first time, Windows creates a hidden file in the user’s AppData folder. That is why we can save user settings, even though the config file is in the same directory as the MyApp.exe
So the answer is, if we run into permission errors when trying to save our settings it means we are writing our settings to the wrong section of the config file. We need to place it in the userSettings section and nowhere else.
For convenience, Visual Studios has a settings editor (the settings tab of the properties page). It allows you to create strongly typed user and application settings. The generated class lets you save user settings, but not application settings for the above reasons.
I have a Wix bundle which allows users to customize installation directory and passes the value to the package during installation. This is implemented using the approach described in this answer: How do I pass a default 'install location' to the RtfLicense bootstrapper?
If the user does not change install directory after running bundle and uninstalling it all files are deleted as expected. If the user does select another installation directory and runs bundle and uninstalls the app the files are not deleted. I guess this happens because the bundle passes default directory but it obviously isn't there. What's more the shortcut that's created during installation is deleted as the shortcut location does not depend on the installation directory.
How can I solve this issue?
The "install location" is not saved by the bundle. The packages have to save anything they need upon installation and read it back during other operations. For an MsiPackage, this is typically done using the "Remember Property" pattern. Directory paths are manipulated as properties so save any directory paths you need.