When an application is running, it will inevitably read and write files and generate new data. However, files under program files cannot be changed at will. Files under win7 will be rejected if they do not have permissions. I have two methods: one is to move the data path to the program data directory, and the other is to grant permissions to the file.
Programdata
<Directory Id="CommonAppDataFolder"> <Directory Id="YourFolder" Name="YourFolder"> <Directory Id=‘dirC9846820F5B48BC9EAD9F647E841B025‘ Name=‘DemoProject‘ > <Directory Id=‘dirF6068DAA29DBB05A7EAD1E3B5A48BBEE‘ Name=‘Data‘ /> <Directory Id=‘dir10737BF4DF605200AA7B844D908DAED9‘ Name=‘GraphicPages‘ /> <Directory Id=‘dir16D2B386B2034B9488996466AAAE0B57‘ Name=‘History‘ /> <Directory Id=‘dirBE8545AE7AB0276E15898AAE7ACFBD7A‘ Name=‘Resource‘ /> </Directory> </Directory> </Directory>
Of course, your application path must support this method.
Get folder Read and Write Permissions
<DirectoryRef Id=‘dirB59C44B238E764B86C6DFC0A8045E3FA‘ > <Component Id=‘cmpB59C44B238E764B86C6DFC0A8045E3FA‘ Guid=‘BDAA4089-F7C0-42E8-928E-B81901938FCD‘ KeyPath=‘yes‘ > <CreateFolder Directory="dirB59C44B238E764B86C6DFC0A8045E3FA"> <Permission User="SYSTEM" GenericAll="yes"/> <Permission User="EveryOne" GenericAll="yes" GenericRead="yes" Read="yes" ReadAttributes="yes" GenericExecute="yes" TakeOwnership ="yes" GenericWrite ="yes" WriteAttributes="yes" ReadPermission ="yes" ChangePermission="yes" /> <Permission User="Users" Domain="[LOCAL_MACHINE_NAME]" GenericRead="yes" Read="yes" ReadAttributes="yes" GenericExecute="yes" TakeOwnership ="yes" GenericWrite ="yes" WriteAttributes="yes" ReadPermission ="yes" ChangePermission="yes"/> </CreateFolder> </Component> </DirectoryRef>
This requires the application of wixutilextension. dll, Wix namespace should also be added: xmlns: util = "http://schemas.microsoft.com/wix/UtilExtension">
At the beginning, if no everyone is added, it cannot be saved. If yes, it is OK. The installation icon has an additional sign.
There should be better methods or ideas. If you pass by, please enlighten me.
Wix installation and deployment tutorials get administrator privileges