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

New Post: Creating environment variables in a Project with merge modules fails.

$
0
0
I'm trying to create an environment inside of an msi that contains several merge modules. For some strange reason though, adding an environment variable to the msi causes the following error:
Unhandled Exception: System.InvalidOperationException: Sequence contains no elements
at System.Linq.Enumerable.First[TSource](IEnumerable1 source)
at WixSharp.Compiler.GetTopLevelDir(XElement product)
at WixSharp.Compiler.ProcessEnvVars(Project wProject, Dictionary
2 featureComponents, List`1 defaultFeatureComponents
, XElement product)
at WixSharp.Compiler.GenerateWixProj(Project project)
at WixSharp.Compiler.BuildWxs(Project project, String path, OutputType type)
at WixSharp.Compiler.BuildWxs(Project project, OutputType type)
at WixSharp.Compiler.Build(Project project, String path, OutputType type)
at WixSharp.Compiler.Build(Project project, OutputType type)
at WixSharp.Compiler.BuildMsi(Project project)
at WixSharp.Project.BuildMsi(String path)
at BlastZone.Program.Main(String[] args) in C:\Users\user\Documents\Visual Studio 2015\Projects\BlastZone\BlastZone
\Program.cs:line 25
I wrote a small program to test it. This one works just fine.
static void Main(string[] args)
        {
            var feature = new Feature("somename", "somedescription");
            var dir = new Dir(@"%ProgramFiles%\somedir",
                new Merge(feature, @"D:\path\mymsm.msm"));
            var project = new Project("testproject",
                dir); 

            project.Platform = Platform.x64;
            project.PreserveTempFiles = true;
            project.BuildMsi();
        }
However, if I do this instead:
var project = new Project("testproject",
                dir, 
                new EnvironmentVariable("foo", "bar"));
My program falls over. Any idea what's causing this, and how can I fix it?

Viewing all articles
Browse latest Browse all 1354

Trending Articles



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