Wixsharp: List directories with wilcards and nested DirFiles

Created on 23 Jul 2018  路  6Comments  路  Source: oleg-shilo/wixsharp

Hi Oleg
this is not a bug but a request and maybe an idea for a new feature.
I'd like to create into the installation directory a variable number of directories reflecting a repository I have on my disc. Then for each directory select all the files which match a specific wild cards. Something like the following

Dirs("c:\temp*machine",
DirFiles("c:\temp*machine*.xml))

Which should mean:

  • go into c:\temp
  • for each directory ending with "machine" take all the file *.xml
  • create the corresponding directory structure into the destination path

What do you think about?

Best regards

Marco

question

All 6 comments

Something like this?

C# new Project("MyProduct", new Dir(@"%ProgramFiles%\MyCompany\MyProduct", new DirFiles(@"\\BuildServer\MyProduct\LatestRelease\*.*"), new Dir("Docs", new DirFiles(@"\\DocumentationServer\MyProduct\*.chm"),

I don't really understand your code sorry... maybe it's better not to go into the code. So the matter is the following: can I create a install package with WixSharp which is able to create a folder tree into the installation folder without hard coding all the directories into the package definition? The idea is that if I add a new directory I don't have to modify the code.

For example if I have a repository like

c:\repository\dir1
file1.txt
file2.txt
c:\repository\dir2
file1.txt
file2.txt
c:\repository\dir3
file1.txt
file2.txt
file3.txt

And I want to have the same directory structure into the installation folder I have to write
new Project("MyProduct",
new Dir(@"%ProgramFiles%\MyCompany\MyProduct",
new Dir("dir1",
new DirFiles(@"c:\repository\dir1\.txt")),
new Dir("dir2",
new DirFiles(@"c:\repository\dir2\
.txt")),
new Dir("dir3",
new DirFiles(@"c:\repository\dir3\*.txt")),

And if I add a new directory to repository I have to add new code like
new Dir("dir4",
new DirFiles(@"c:\repository\dir3\*.txt")),

I'd like to automate this maybe with something like
new Project("MyProduct",
new Dir(@"%ProgramFiles%\MyCompany\MyProduct",
new DirDirectories("C:\repository\dir", ".txt)",

The first parameter of DirDirectories gives the pattern to match for the directory name and the second the pattern for the files.

Marco

Yes the implements exactly your use case.

The sample is covering the case when the software release is build and the binaries of the solution are aggregated after the build in the dedicated folder. Then WixSharp discovers and includes the all files and the sub-directories into the built MSI:
C# var project = new Project("MyProduct", new Dir(@"%ProgramFiles%\My Company\My Product", new Files(@"..\Release Folder\Release\*.*") . . .

Have a look at the complete "ReleaseFolder" code sample for the details.

Ok... thanks
I'll try and let you know
Marco

Great Oleg! It works perfectly
thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

UweKeim picture UweKeim  路  5Comments

CADbloke picture CADbloke  路  4Comments

Chrissyoung1223 picture Chrissyoung1223  路  5Comments

mgkeeley picture mgkeeley  路  5Comments

kain64 picture kain64  路  4Comments