It's hard for me to comment your code as it is incomplete. I can only advise you to start with the working complete sample from the distro. My very simple test (below) showed no problems with combining
You may use GitHub (https://github.com/oleg-shilo/wixsharp) for further discussions.
Merge
and EnvironmentVariables
: class Script { staticpublicvoid Main(string[] args) { var featureA = new Feature("Feature A", "Feature A description"); var featureB = new Feature("Feature B", "Feature B description"); var complete = new Feature("Complete"); complete.Add(featureA) .Add(featureB); var project = new Project("MyMergeModuleSetup", new Dir(@"%ProgramFiles%\My Company", new File(featureA, @"Files\MainFile.txt"), new Merge(featureB, @"Files\MyMergeModule.msm"), new Merge(featureB, @"Files\MyMergeModule1.msm")), new EnvironmentVariable("foo", "bar")); project.DefaultFeature = complete; project.UI = WUI.WixUI_FeatureTree; project.InstallerVersion = 200; //you may want to change it to match MSM module installer version project.PreserveTempFiles = true; project.BuildMsi(); } }