permissions - Unable to delete deployed file during installation with WIX installer -
in our wix installer project, need generate new file, let's call fileb, based on deployed file, called filea in managed custom action function. in word, in component declaration, declare filea. while in custom action (which happens @ commit phase), need generate fileb based on filea. after that, since filea no use anymore, want delete in same custom action.
and here comes problem: default installation folder, program files, normal user not allowed add file (generate fileb) folder in custom action (i not 100% sure right, case in test. , if install in folder, there no problem @ all). think need give permission of creating file. in order that, add createfolder element component includs filea. whole component declaration this:
<component id='component_name' guid='my_guid'> <!--other files in component--> ... <createfolder directory='installdir'> <permission createfile='yes' user='everyone' genericall='yes' delete='yes'/> </createfolder> <file id='myfilea' name='filea' source='path_to_filea' keypath='no' > <permission genericall='yes' user='everyone' delete='yes'/> </file> </component>
the component belongs component group, resides in installdir. reason there other files in same component element because want file keypath, deleting filea not cause problem of that. , generation of fileb working fine. later in same custom action, experiencing problem when deleting filea. says ": access path 'deployment_path_to_filea' denied." thought problem lies in filea declaration, that's why added delete='yes' in permission element under file, hoping make ok delete (although not sure whether means in installation possible delete). still error. can tell me did wrong?
another question is, don't know purpose of creatfolder elements. 1 thing: if aim create directory structure, think (nested)directory elements that. , why have such element under component element when of time want directory structure separated component structure(the components use directory reference refer correct directory). secondly, default directory property of createfolder parent directory component resides in. common more 1 components reside in same directory, have here: multiple components in same component group, directory element references installdir. 1 of these components has createfolder element, directory property in case parent directory of components. hard understand structure. guess have misunderstanding of createfolder element. can enlighten me usage of createfolder? thanks!
thanks!
a number of issues address here. first, should know commit phase custom actions don't execute if rollback disabled. should have deferred , rollback custom action.
second, can't tell msi install file , go delete it. that's counterproductive , causes servicing issues down road. better solution ( i'm assuming using wix dtf managed custom action ) include filea content item in custom action project. cause file exist in current (temp) directory of custom action while execute. can generate fileb. rollback, can delete fileb.
you'll need author removefile element teach msi delete file on uninstall. otherwise won't since msi doesn't know fileb created out of process custom action.
otherwise it'd useful know contents of fileb are. easier implement if xml file installed fileb , transformed using xml wix extension.
Comments
Post a Comment