That is very much not a good design. The Windows Installer an create shortcuts 
just fine. And uninstall them and roll them back and handle all the other 
scenarios you need to think about when putting a file (like a shortcut) on 
disk.  This is a very bad suggestion below.

All you need is to set the directory for the shortcut correctly. That may (but 
doesn't seem like it should) a custom action to find the path... but once the 
directory is set, let the Windows Installer do the heavy lifting of actually 
creating the shortcut.

-----Original Message-----
From: Pavan Konduru [mailto:pavan.kond...@accelrys.com] 
Sent: Friday, February 21, 2014 12:59 PM
To: General discussion about the WiX toolset.
Subject: Re: [WiX-users] Adding Application Shortcut to Specific User's Startup 
Folder.

You can use a Custom action to set a shortcut in the user directory. I am 
assuming your installer is per machine, hence all shortcuts are in the general 
start menu but you just need one shortcut that must be created in the user 
profile?
I see that you got the directory structure(that is for Wind 7 ) but isn't the 
start menu different for different windows OS flavors?Win 2003 server has this 
structure:

C:\Documents and Settings\<User>\Start Menu\Programs

I did something like this and it worked (but you would have to handle the 
deletion manually during uninstall)

WshShell shell = new WshShell();

            string shrtcutLnk = "App.lnk";

            IWshShortcut MyShortcut;
pathString= Environment.GetFolderPath(Environment.SpecialFolder.StartMenu);
           
            MyShortcut = (IWshShortcut)shell.CreateShortcut(pathString + 
shrtcutLnk);
          
            MyShortcut.TargetPath = "";
            MyShortcut.Arguments = " ";

            MyShortcut.WorkingDirectory = "";
            MyShortcut.Description = "Launch blah blah";
         
            MyShortcut.IconLocation = "MyIco.ico";
          
            MyShortcut.Save();


This line of code returns the current users startmenu folder, which in mycase 
was:
pathString= Environment.GetFolderPath(Environment.SpecialFolder.StartMenu);

"C:\\Users\\pavan.konduru\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu"


--Pavan

-----Original Message-----
From: Walter Dexter [mailto:wfdex...@gmail.com]
Sent: Friday, February 21, 2014 9:56 AM
To: General discussion about the WiX toolset.
Subject: Re: [WiX-users] Adding Application Shortcut to Specific User's Startup 
Folder.

I'll have to look into <SetDirectory ..../>. That looks cleaner than my custom 
action route.


On Fri, Feb 21, 2014 at 5:06 AM, <paul.chor...@stfc.ac.uk> wrote:

> Walt,
> All working for install & uninstall now thanks to your prompting & 
> explanation of the directory attribute.
>
> For future reference:-
>
> I also tried using the WindowsVolume supplied property to get to the 
> root of things in a drive letter independent way. This resulted in an 
> error. I then saw this link by Ravikumar Gopinath:-
>
>
> http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Error-us
> ing-WindowsVolume-predefined-folder-td3313078.html
>
> So using this seems to provide a drive letter independent solution:-
>
>     <SetDirectory Id="WINDOWSVOLUME" Value="[WindowsVolume]"/>
>
>     <Directory Id="TARGETDIR" Name="SourceDir">
>       <Directory Id="WINDOWSVOLUME">
>         <Directory Id="UsersDir" Name="Users">
>           <Directory Id="User1Dir" Name=user1">
>             <Directory Id="AppdataDir" Name="Appdata">
>               <Directory Id="RoamingDir" Name="Roaming">
>                 <Directory Id="MicrosoftDir" Name="Microsoft">
>                   <Directory Id="WindowsDir" Name="Windows">
>                     <Directory Id="StartmenuDir" Name="Start Menu">
>                       <Directory Id="ProgramsDir" Name="Programs">
>                         <Directory Id="StartupDir" Name="Startup">
>                         </Directory>
>                       </Directory>
>                     </Directory>
>                   </Directory>
>                 </Directory>
>               </Directory>
>             </Directory>
>           </Directory>
>         </Directory>
>       </Directory>
>     </Directory>
>
>     <DirectoryRef Id ="StartupDir">
>     <Component Id="CMP_MyAppStartupShortcut" Guid="GUID Here"
> KeyPath="yes">
>
>       <Shortcut Id=" MyAppStartupShortcut " Name="MyApp"
>           Description="Launch MyApp"
>           Target="[ProgramDir]MyApp.exe" WorkingDirectory="ProgramDir"
>           Icon="icon.ico"/>
>
>     </Component>
>     </DirectoryRef>
>
> Cheers,
> Paul
>
> -----Original Message-----
> From: Walter Dexter [mailto:wfdex...@gmail.com]
> Sent: 20 February 2014 16:16
> To: General discussion about the WiX toolset.
> Subject: Re: [WiX-users] Adding Application Shortcut to Specific 
> User's Startup Folder.
>
> I was just coming in to correct the path...
>
> The problem you're having is that the Directory attribute is supposed 
> to be the ID of a directory, not the path to a directory.
>
> Here's how I'm dealing with absolute paths. My standard disclaimer 
> with WiX advice is that I first used WiX in November and I still don't 
> feel like I know what I'm doing, so there may be a much easier way to do 
> anything.
>
>
> <CustomAction Id="CA_SetCDrive" Directory="C_DRIVE" Value="c:\" />
>
> <InstallExecuteSequence>
> <Custom Action="CA_SetCDrive" After="CostFinalize" /> 
> </InstallExecuteSequence>
>
> <Directory Id="TARGETDIR" Name="SourceDir">
>     <Directory Id="C_DRIVE" Name="CDrive"> <Directory Id="DIR_PROGRAMDATA"
> Name="ProgramData" >
>     <Directory Id="DIR_MICROSOFT" Name="Microsoft" > <Directory 
> Id="DIR_POINTOFSERVICE" Name="Point of Service" >
>     <Directory Id="DIR_CONFIGURATION" Name="Configuration" /> 
> </Directory> </Directory> </Directory> </Directory> </Directory>
>
> Then, assuming you got all the rest of your values right, you would have:
>
>    <Shortcut Id="MYShortcut" Name="MyApp"
>           Description="Launch MyApp"
>           Target="[ProgramDir]MYApp.exe" WorkingDirectory="ProgramDir"
>           Icon="icon.ico" Directory="DIR_CONFIGURATION"/>
>
> and your shortcut would land in c:\ProgramData\Microsoft\Point of 
> Service\Configuration. (Not a sensible place to put a shortcut, of 
> course, but it's the snippet I could steal easily.)
>
> I assume that you have an <icon .... /> element with Id="icon.ico" 
> because I think that's an ID as well. I've never done a shortcut or 
> icon in WiX, though. We don't even have the explorer shell running. We 
> have a custom shell that has it's own way of doing Startup and RunOnce.
>
> Good luck-
>
> Walt
>
>
>
> On Thu, Feb 20, 2014 at 8:47 AM, <paul.chor...@stfc.ac.uk> wrote:
>
> > Hello Ilir,
> >
> > Thanks for your response, how do I add a shortcut to that path in 
> > WIX (C:\Users\<TheUser>\AppData\Roaming\Microsoft\Windows\Start
> > Menu\Programs\Startup)?
> >
> > Cheers,
> > Paul
> >
> > -----Original Message-----
> > From: Ilir Bekteshi [mailto:ilir...@gmail.com]
> > Sent: 20 February 2014 13:22
> > To: General discussion about the WiX toolset.
> > Subject: Re: [WiX-users] Adding Application Shortcut to Specific 
> > User's Startup Folder.
> >
> > If you want your Shortcut to appear in Startup folder for everyone 
> > then put it in C:\ProgramData\Microsoft\Windows\Start
> > Menu\Programs\Startup
> >
> > For a specific user then
> > C:\Users\<TheUser>\AppData\Roaming\Microsoft\Windows\Start
> > Menu\Programs\Startup
> >
> >
> >
> >
> > On Thu, Feb 20, 2014 at 1:06 PM, <paul.chor...@stfc.ac.uk> wrote:
> >
> > > Hello,
> > >
> > > I have a kiosk type PC system, that on boot up, automatically logs 
> > > on a special restricted user account with a preconfigured password.
> > > My application then launches automatically using a shortcut 
> > > present in only that special users Startup folder. The 
> > > installation scope is per machine as other users may need to run 
> > > the application from time to time for diagnostic purposes. The 
> > > application installation is always done using an admin account.
> > >
> > > In the past using VS2010:-
> > >
> > > 1.       The solution MS "Setup Project" installed all of the common
> > > features successfully.
> > >
> > > 2.       I utilized the MS "Installer Class" which through some c# code
> > > created an application shortcut in the special user's startup 
> > > folder during installation and removed it during uninstallation.
> > >
> > > With the demise of the above VS2010 features in later VS versions 
> > > I have just over the last two weeks looked at WIX as an alternative.
> > > So far the WIX project will successfully install & uninstall the 
> > > common features successfully, that is DLL, EXE files and some 
> > > simple all user application shortcuts on the desktop and start menu.
> > >
> > > After searching for ages, I cannot determine how to set a startup 
> > > shortcut in just the special user account. From my searches this 
> > > does not appear to possible just using the basic WIX.
> > >
> > > I would really appreciate some directional guidance. Maybe a "C# 
> > > custom action project" should be used? Or a batch file?
> > >
> > > Cheers,
> > > Paul
> > >
> > >
> > > --
> > > Scanned by iCritical.
> > >
> > >
> > > ------------------------------------------------------------------
> > > --
> > > --
> > > -------- Managing the Performance of Cloud-Based Applications Take 
> > > advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> > > Read the Whitepaper.
> > >
> > > http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.
> > > clktrk _______________________________________________
> > > WiX-users mailing list
> > > WiX-users@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/wix-users
> > >
> >
> > --------------------------------------------------------------------
> > --
> > -------- Managing the Performance of Cloud-Based Applications Take 
> > advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> > Read the Whitepaper.
> >
> > http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.
> > clktrk _______________________________________________
> > WiX-users mailing list
> > WiX-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> > --
> > Scanned by iCritical.
> >
> >
> > --------------------------------------------------------------------
> > --
> > -------- Managing the Performance of Cloud-Based Applications Take 
> > advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> > Read the Whitepaper.
> >
> > http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.
> > clktrk _______________________________________________
> > WiX-users mailing list
> > WiX-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> >
>
> ----------------------------------------------------------------------
> -------- Managing the Performance of Cloud-Based Applications Take 
> advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.
> clktrk _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
> --
> Scanned by iCritical.
>
>
> ----------------------------------------------------------------------
> -------- Managing the Performance of Cloud-Based Applications Take 
> advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.
> clktrk _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications Take advantage of what the 
Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users



------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications Take advantage of what the 
Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to