Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Environment variable


5 replies to this topic

jlai

jlai
  • Members
  • 7 posts

Posted 03 May 2005 - 21:34

Hi,
I added a new key "Environment" under User/Machine Hive. All the values added under Environment would then be added to user's environment variables.
This works when I install the setup project for a single user (just for me). However, installation failed when I tried to install it to everyone.
I got this error message,
"Could not write value MY_PATH to key \Environment. Verify that you have sufficient access to that key, or contact your support personnel"

I logged in a domain user who has administrator priviledge. And, the default installation folder is not in the Program Folders, but in the top-level system drive directory.
Does anyone know what's happeing here?

Thanks,
Jennifer


luke_s

luke_s
  • Full Members
  • 532 posts

Posted 04 May 2005 - 00:33

How are you adding the environment variable?

You should use the "Environment" table to add this, and not the registry table.

jlai

jlai
  • Members
  • 7 posts

Posted 04 May 2005 - 01:01

where is the Environment table?
do you mean to use orca to edit the database?
any examples you can give?

Thanks,
Jennifer

jlai

jlai
  • Members
  • 7 posts

Posted 04 May 2005 - 15:18

What I'm trying to do is that, if user selects the "just me" option in the installer, only user environment variables are set. ANd, if user selects "for everyone" option in the installer, all users on the system should be able to see the changes.
How can I do this through registry editor in the .Net Setup Project?

Thanks,
Jennifer

_nick_

_nick_
  • Members
  • 34 posts

Posted 04 May 2005 - 15:43

The setup editor built into Visual Studio is a bit limited so you might want to consider using other tools.

ORCA is the database editor that ships with the platform SDK, which you should have installed if you are authoring an install package. You will have to run Orca.msi found in [Platform SDK Install Dir]\Bin to install Orca. After that you should have the option to edit all msi files using Orca via the right click context menu.

You can find information about the environment table at
http://msdn.microsof...nment_table.asp

I would recommend using WiX to generate the install. If you did this, I beleive you could include the following tags in a component of your installation
CODE

<Environment Id="EnvironmentVariable1User" Action="Create" Name="Name1" Part="All" Permanent="No" System="No" Value="Value1">ALLUSERS</Environment>
<Environment Id="EnvironmentVariable1AUser" Action="Create" Name="Name1" Part="All" Permanent="No" System="Yes" Value="Value1">ALLUSERS</Environment>


The <Environment></Environment> tags add the specified environment variable. Setting System=no makes is it a user variable and yes makes it a machine variable. The ALLUSERS inside of the tag should condition the creation of the variable, but I have never created an environment variable so I'm guessing that this will work.

Information on the ALLUSERS property can be found at:
http://msdn.microsof...up/allusers.asp

jlai

jlai
  • Members
  • 7 posts

Posted 04 May 2005 - 20:25

Thanks! I fixed the problem w/o going into Orca tool.
Under registry editor in .NET setup project,
I put those user environment variables under HKEY_CURRENT_USER/Environment, then depends on installation option ("just me" or "for everyone"), these variables would be added to one or multiple users' environment variables.

If anyone wants to add system variables, it can be done by adding to HKEY_LOCAL_MACHINE. If an user doesn't have administrator priviledge, then user would get a error message saying not having correct priviledge rights.
If you don't want users to see this error message, or want user continue installation without adding system variables, you can add variables under User/Machine Hive/System/CurrentControlSet/Control/Session Manager/Environment.

Edited by jlai, 04 May 2005 - 20:43.