Tech Off Thread

14 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

How to modify PATH on a setup projet ?

Back to Forum: Tech Off
  • User profile image
    cro

    I didn't know where to post that question on the msdn forum, so I will try it here.

    I need to add the path of an app to the PATH environnement variable when deploying my app. I'm using VS2005 setup projet and I don't know how to do this.  

    Any idea ?

  • User profile image
    eckes

    My suggestion would be to not do it. It is pretty annyoing that all kind of applications mess with the PATH. Only a very limited set of applications actually need it, and those (command line tools) are usually operated by users who want to do it themself.

    You have a fully qualified path to your application in the start menu link. If you need more environmental setup you are only asking for trouble and additional support.

    Gruss
    Bernd

     

  • User profile image
    cro

    My application rely on MapX and Vertical Mapper. Vertical Mapper need to have is PATH added to the envrionnement to work with MapX. I didn't find any workaround except to copy Vertical Mapper under my app folder.

    I would prefer to add the PATH insted of having the chance to have Vertical Mapper install in more then one place.



  • User profile image
    AndyC

    The correct way to do this is to add an entry to the Environment table in the MSI file. However Visual Studio's builtin setup project editor doesn't give you enough flexibility to do that.

    You'll either need a better Windows Installer creation tool or you could hack the MSI created by VS using Orca from the Platform SDK.

  • User profile image
    cro

    Is it possible to add it using VBScript ?

     

  • User profile image
    AndyC

    It might be possible to do with VBScript, but it'll be awkward (particularly trying to undo the changes properly in the event of a rollback/uninstall).

    MSI has an Environment table for a reason...

  • User profile image
    cro

    And what about Wix ? What do you thing will be the easiest thing to do ?  Using Wix, or hack my MSI create from Visual Studio 2005 with Orcas (assuming Orcas is available).

  • User profile image
    AndyC

    Adding the entry in Orca is easy if it is just a one-off. If you need it to be part of a longer-term solution, WiX might be a better choice.

    IIRC, WiX has a tool for creating a WiX script from an MSI so you could always use VS to do the bulk of the work and then import it into WiX to take advantage of the extra features.

  • User profile image
    cro

    Ok, now I have my setup that I have create with VS2005. It work just fine, except that I have to manualy add the path of Vertical Mapper to the path variable. 

    Where should I look the add a path to the environnement ?

    I have received this warning when using dark.exe to convert my msi files to wix xml :

    dark.exe : warning DARK1024 : Action 'MsiUnpublishAssemblies' in sequence 'AdvtExecuteSequence' is not a custom action, dialog, supported standard action, or known special action so this action is being left out.

    Any idea ?

  • User profile image
    AndyC

    I think the best place to start is the WiX site, the tool for converting an MSI to a WiX script is called dark.

    As to the specifics of adding environment variables, it's just a matter of creating an appropriately formatted string in the Environment table.

  • User profile image
    cro

    Thanks, everythings work now. I also try ORCA, it's a great tool ! Visual Studio doesn't seem to create clean valid MSI. ORCA report 3 warnings and it look like that each file is a component.

  • User profile image
    cro

    One last question (I hope). Since my setup program modify the PATH variable and install the .NET Framwork 2.0, you must be an admin to run the setup.

    For now on my setup can be execute by a limited user, but display error messages.

    So, how can I specify that you must have administrator permissions to execute the setup ?

  • User profile image
    AndyC

    It basically boils down to making installation conditional based on the Privileged property. Note, you should use Privileged rather than AdminUser or your install will break in certain scenarios (such as UAC on Vista)

  • User profile image
    rjdohnert

    Generally mucking with the PATH is not a good idea, as a previous poster said for Command Line tools it makes sense.  I do it on the CorePak, but if its a graphical application just create a desktop icon and program menu set.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.