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

New Post: Maintain directory structure

$
0
0
I've been trying to create an installation msi, but I keep getting duplicate id error and I have no idea what I'm doing wrong. I tried to add my own identifiers, but the installation fails.

The error: Duplicate symbol 'Directory:INSTALLDIR.myFolder' found. This typically means that an Id is duplicated. Check to make sure all your identifiers of a given type (File, Component, Feature) are unique.

Additionally, and unrelated, I tried to do a silent install with a generated msi, but I'm only able to get it to actually install if I run with elevated privileges. Is there a way to perform a silent install from any command input?

Thank you. :)

Here's the code:
    static void Main(string[] args)
    {
        var dir = PopulateDir("myFolder", true);

        var project = new Project("a_myApp", dir);

        project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b");
        project.UI = WUI.WixUI_InstallDir;

        Compiler.PreserveTempFiles = true;
        Compiler.BuildMsi(project);
    }

    private static Dir PopulateDir(string sDir, bool isRoot)
    {
        Dir dir;
        try
        {
            var fileList = System.IO.Directory.GetFiles(sDir);
            var dirList = System.IO.Directory.GetDirectories(sDir);

            WixEntity[] eList = new WixEntity[fileList.Length + dirList.Length];

            for (int i = 0; i < fileList.Length; i++)
                eList[i] = new File(fileList[i]);

            for (int i = 0, e = fileList.Length; i < dirList.Length; i++, e++)
                eList[e] = PopulateDir(dirList[i], false);

            if (isRoot)
                dir = new Dir(@"%ProgramFiles%\ACompany\myApp", eList);
            else
                dir = new Dir(sDir, eList);
        }
        catch
        {
            return null;
        }

        return dir;
    }

Viewing all articles
Browse latest Browse all 1354

Trending Articles



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