Quantcast
Channel: wixsharp Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1354

New Post: More then one Projekt as InstallerFiles

$
0
0
This will not work. There are quite a few wrong things with your code:
  • As any LINQ extension method Distinct does not modify the collection. You need to reassign it.
  • Also your Distinct will not work anyway as DirFileCollections is a list wild card patterns not the resolved files.
  • Wix# doesn't have DirFiles constructor that you specified.
You need to use lambdas in the constructor with wildcard:
var sharedDLLs = new [] { "shared1.dll",  "shared2.dll" }; 

var ProgrammDir = new Dir($"%ProgrammFiles%/{Manufacturer}/{Produkt}",
                               new File (MainExe,
                               new FileShortcut("","")),
                               new DirFiles(@"outDir1\.*.dll",  x => ! sharedDLLs.Contains(Path.GetFileName(x))),
                               new DirFiles(@"outDir2\.*.dll", x => ! sharedDLLs.Contains(Path.GetFileName(x)))
                        );
...
project.ResolveWildCards();
var dir = project.FindDir("whatever");
dir.Files = dir.Files.Add(new File("whatever_dll"));
This is how you filter duplicates and add files explicitly but I am not sure it is what you need. It didn't look like the most elegant solution. May be something like this is a bit better:
var alreadyAdded = new List<string>(); 

Func<string, bool> ifNew = (file)=>
{
    if(alreadyAdded.Contains(file))
        returnfalse;
    alreadyAdded.Add(file);
    returntrue;
};

var ProgrammDir = new Dir($"%ProgrammFiles%/{Manufacturer}/{Produkt}",
                               new File (MainExe,
                               new FileShortcut("","")),
                               new DirFiles(@"outDir1\.*.dll",  ifNew),
                               new DirFiles(@"outDir2\.*.dll", ifNew)
                        );

Viewing all articles
Browse latest Browse all 1354

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>