What's the best way to create a folder for my application in application data (All Users/AppData or ProgramData depending on OS) during setup?
<Directory Id="CommonAppDataFolder" Name="CommonAppData">
<!-- your subdir structure here -->
</Directory>
Use the CommonAppDataFolder property get a reference to the currect directory ( OS specific ) and then nest Directory elements along with a Component element and CreateFolder element to get the directory built out.
Also be aware of the default folder permissions of this part of the filesystem and compare it against your expectations.
Related
with the Wix Toolset v3.11 I have created a .msi file for my application (let's say version 1.1) with a Directory element that targets the LocalAppDataFolder and puts a Temp folder underneath. This structure is used with a DirectoryRef element to put some files there that are accessed within a custom action on InstallFinalize. Now I generated a Patch (version 1.2) that adds some files in the Temp folder. But I want that folder to be in the TARGETDIR now. So I changed
<Directory Id="LocalAppDataFolder">
<Directory Id="APPDATA_TEMP" Name="Temp" />
</Directory>
to
<Directory Id="MY_TEMP_PATH" Name=".">
<Directory Id="APPDATA_TEMP" Name="Temp" />
</Directory>
underneath the
<Directory Id="TARGETDIR" Name="SourceDir">
structure. For the Patch to be applied correctly I opened the .msi file that's referenced in the registry (under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\...\Products{GUID}\InstallProperties\LocalPackage) with the Orca tool and edited the corresponding values in the Directory table. I also edited the CustomActions table to reference the new path as it is used as a parameter there. So, now when I install the Patch it puts all the files (changed and new ones) in the LocalAppDataFolder as it did with the initial install. The custom action is called with the correct parameter though.
Is there a way to change the "base" msi to target my new Temp folder or, alternatively, somehow tell the Patch to use the new folder regardless of the initial path?
The goal is to apply the patch without having to uninstall the application first.
Any help on how to achieve that is greatly appreciated.
Finally we found a solution. So here's what solved our problem, should anyone ever come across something similar:
We found the actual path of the LocalAppDataFolder in two locations in the registry: The first entry is located in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\Folders. The second one is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData...\Components. The entry with the component ID that puts the files in the Temp folder holds exactly one value, which is the path to the first file in that component. We changed both paths to our new temp folder.
Now the patch extracts the files correctly to the new temp folder and the custom action can process them further.
I'm running a Yii app with Wampserver, I pulled it from a git repository so it had no assets folders, I had to manually create each one because it was throwing a CException.
Now when I load any page Yii creates some folders with random names inside my assets folders, but they're all empty. Edit: Just noticed one of the folders created is full of files, but the other is totally empty and that's where it is trying to load all bootstrap files.
I've tried deleting them again but I have the same result, also tried adding SAFE_MODE in php.ini, running wamp as admin and adding this in the apache conf:
<Directory "*/assets/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
I read the 'Understanding assets' post but the only useful thing I found was:
It's important that the directory be writable by the webserver user so
that Yii can publish the resources there when needed
Yet I can't find how to do it for Wampserver
So, what am I supposed to do?
Thank You
I just found out what was going on, the application is using a bootstrap component which has an "assets" folder as well, since git was ignoring that folder it was empty and the component wasn't able to publish the files in the application assets. I just put the original component files inside that folder and the problem is now solved.
As a part of my project, the installer has to copy files to network share(\system_name\Folder). I have tried it using the <Directory> element defining the path to the share (NetHoodFolder property) but it's throwing an error.
Error 5 ICE64: The directory SP9381 is in the user profile but is not listed in the RemoveFile table. C:\Wix\MainProject\MainProject\Product.wxs 25 1 MainProject
Can we do the same using element ? Is there any other way to copy files to network share?
You can copy files to a network share but there are a number of limitations. First, to get around the ICE issue, try structuring your directory tree like so:
<Directory Id='TARGETDIR' Source='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='NETWORKSHAREFOLDER' Name='network'>
</Directory>
</Directory>
Then somehow you need to get the network share to be known. You could ask in the UI or take it from the command-line or whatever. I hardcoded the string in my test case (definitely not recommended for reals):
<Property Id='NETSHARE' Value='\\server\share\folder' />
<SetDirectory Id='NETWORKSHAREFOLDER' Value='[NETSHARE]' />
If you wanted to pass it on the command line, don't add any of the above, just do:
msiexec /i path\to\your.msi NETWORKSHAREFOLDER="\\server\share\folder"
Basically, just root your NETWORKSHAREFOLDER in a well known folder and then change it later as explained above.
I am designing a WIX 3.6 installer project, during the installation we need to grand the user create file permission to the install folder(INSTALLDIR, especially with the default install folder, the Program Files, the user normally can't create file in the installation. We've experienced some failures). I guess it can be achieved by setting a Permission element, with CreateFile property. However, the INSTALLDIR is a directory, and only such elements as CreateFolder, File, FileShare, Registry, ServiceInstall can have permission element. So could anyone tell me how to do that? My directory declaration is something like this:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id='MANUFACTUREFOLDER' Name='$(var.ManufacturerName)'>
<Directory Id="INSTALLDIR" Name="$(var.ProductName)">
Thanks!
UPDATED:
Now I have managed to create a file (not the deployed file. But a generated file based on one deployed file, and it is generated in a custom action in commit phase). However, I now have a problem deleting the deployed file I just described (because there is no use of it after the other file is successfully generated). When the installation folder is Program Files, I can't delete it in the custom action. It says access denied.
Another thing is, I really don't understand the purpose of CreateFolder element. If its aim is to create a folder, as its name implies, don't nested Directory(s) do the same thing, as in my example code? And I think it is more clear to describe the folder structure there since it is very common to separate the Component elements (in which CreateFolder elements will reside) and the Directory elements. The Component will just use DirectoryReference to refer to the correct directory. Secondly, it is also common that multiple Components reside in the same Directory. So if I add a CreateFolder to one of those Components, with the default directory as the common parent directory of those Components, what does it even mean? It is really not intuitive of such a structure.
As you noted, CreateFolder elements may have Permission elements, and they default to the directory of the parent component if no directory is specified. So the structure would look something like the following.
<Directory Id="INSTALLDIR" Name="$(var.ProductName)">
<Component>
<CreateFolder>
<Permission>
</Permission>
</CreateFolder>
</Component>
</Directory>
However, based on Vista and Windows 7 restrictions and Windows Logo guidelines, I wouldn't be surprised if you still have issues with this, since the Program Files directory is pretty locked down. After install you should not be writing to this directory.
When I make my WIX Build setup,
by default it installs into the ProgramFIles directory.
I want to change this to the Application Local Data directory,
How would I do this?
Thanks
You can use folder definitions like this:
<Directory Id='LocalAppDataFolder'>
<Directory Id='MyAppFolder' Name='MyApp' />
</Directory>
To find the IDs of other system folders like LocalAppDataFolder, take a look at the System Folder Properties section of the Windows Installer Property reference.
Are you doing a per-user installation using the built in dialog sets?
If you set Package/#InstallScope="perUser" then the default installation folder will automatically be set to [LocalAppDataFolder]Apps\[ApplicationFolderName]
For more information refer to the WiX manual.