Updating files that are already included for the install

May 14, 2015 at 4:23 PM
Currently I'm doing something like this:
        wixProject.SourceBaseDir = @"C:\projects\MyProject";
        string targetPath = @"%ProgramFiles%\MyCompany\MyProduct";

        Files files = new Files(wixProject.SourceBaseDir + @"\*.*");

        Dir rootDir = new Dir(targetPath, files);
        wixProject.Dirs = new[] { rootDir };
...this allows me to include all the files in the MSI easily.
Now, how do I add/update the "files collection" to create a shortcut for a file that is already included? Any easy way? Thanks.
May 14, 2015 at 5:39 PM
NVM this, I found the answer:
        wixProject.ResolveWildCards(ignoreEmptyDirectories: true)
                       .FindFile((f) => f.Name.EndsWith("MyApp.exe"))
                       .First()
                       .Shortcuts = new[] {
                                   new FileShortcut("MyApp", @"%ProgramMenu%\MyCompany\MyApp") { IconFile = wixProject.ControlPanelInfo.ProductIcon },
                                   new FileShortcut("MyApp", "%Desktop%") { IconFile = wixProject.ControlPanelInfo.ProductIcon }
                              };