Visual Studio Setup Project - How to Obtain the Directory Path from a File-Search Launch Condition -


i looking way add file(s) existing directory has random name part of visual studio setup project , hoped might able me solve puzzle please.

i have been attempting obtain discovered path property of directory using launch condition; unfortunately method returns full file path including filename, cannot used directory property.


the directory in question takes form [appdatafolder]company\product\aaaaaaaaaaaa\ aaaaaaaaaaaa random installation string.

within launch condition setup check directory's existence searching file appear inside it,

search target machine

(name): file marker filename: sample.txt  folder: [appdatafolder]company\product\ property: dirfile 

launch condition

(name): file marker exists condition: dirfile 

in setup project add file wish insert, details

condition: dirfile folder: 'installation folder' 

then in file system setup add new folder entry random directory aaaaaaaaaaaa

(name): installation folder  condition: dirfile defaultlocation: [dirfile]\..\ *incorrect* property [dirlocation] 

as can see installer detects existence of marker file but, instead of placing file @ same location, when using [dirfile] installer incorrectly try , insert file;

this because file path returned

[appdatafolder]company\product\aaaaaaaaaaaa\sample.txt 

where instead need directory path

[appdatafolder]company\product\aaaaaaaaaaaa 

therefore wondering if possible return directory file found in search target machine (as opposed file location of file), if extract directory path performing string replace of filename on file location dirfile within defaultlocation field in file system setup, or if perhaps there method missing?

i'm interested in simple solution this, inside setup project.

the way did solve install files temporary location , copy them final location in afterinstall event handler. not elegant solution! since no longer care user selected target path removed dialog. needed take special care when uninstalling.

public override void onafterinstall(idictionary savedstate) {     base.onafterinstall(savedstate);      // original file folder     string origindir = context.parameters["targetdir"];      // new file folder based on dir of sample.txt     string newdir = path.getdirectoryname(context.parameters["dirfile"]);      // application executable file name      // (or loop files on path instead)     string filename = "applicationname.exe";      // move or copy file     file.move(path.combine(origindir, filename), path.combine(newdir, filename))); } 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -