How to set registry key during msi install process

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I set or create a registry key during the installation of our .net
projects?

Thanks.
 
How can I set or create a registry key during the installation of our
.net projects?

That would depend on how you're installing said products.

I use NSIS, others use Installshield and there are many others.

You might also consider creating the key on the first run of the app itself
if if doesn't find it in place when it runs
 
It's an MSI file using .net 2003.



Rory Becker said:
That would depend on how you're installing said products.

I use NSIS, others use Installshield and there are many others.

You might also consider creating the key on the first run of the app
itself if if doesn't find it in place when it runs
 
Sorry I missed the "MSI" bit in your subject.

But the idea of creating said keys on first run is still a potential solution
 
First run of what? there are many projects that might need it, including MS
Office files outside the project.

Whenever I install the solution, I must create it manually. If I create it
as part of the runtime I would have to replicate the code in every project
basically. I don't think that works.
 
First run of what? there are many projects that might need it, including MS
Office files outside the project.

Whenever I install the solution, I must create it manually. If I create it
as part of the runtime I would have to replicate the code in every project
basically. I don't think that works.


Sorry I missed the "MSI" bit in your subject.
But the idea of creating said keys on first run is still a potential
solution

IMO Best practice dictates that when you use a Registry value you
first inspect to see if it exists. If it does not exist, this is the
time you should initialize the key with the appropriate value. This is
what Rory is referring to.

After all, suppose a user installs your application and the values is
initialized during setup. A week later the user's computer starts
acting up (from no fault of yours) and the user does a restore that
resets all the registry values back to there state previous to your
programs installation. The user starts your application and *bam* is
greated by a JIT debugging window stating a null reference exception
occurred. The point is, prerequisites are often deleted after the
install - so your code should be ready and able to handle these
occurrences. This is why I believe the registry parts of an
application should initialize themselves, and not rely on a setup
utility.

Thanks,

Seth Rowe
 
I get it, but this is a non-issue in our environment. We control the
software at the client and the only time this registry key could be
overwritten would be by us.

Am I to assume then, based on the opposition to my original stated question,
that a registry key cannot be set by the msi installation process?


rowe_newsgroups said:
First run of what? there are many projects that might need it, including
MS
Office files outside the project.

Whenever I install the solution, I must create it manually. If I create
it
as part of the runtime I would have to replicate the code in every
project
basically. I don't think that works.


Sorry I missed the "MSI" bit in your subject.
But the idea of creating said keys on first run is still a potential
solution

IMO Best practice dictates that when you use a Registry value you
first inspect to see if it exists. If it does not exist, this is the
time you should initialize the key with the appropriate value. This is
what Rory is referring to.

After all, suppose a user installs your application and the values is
initialized during setup. A week later the user's computer starts
acting up (from no fault of yours) and the user does a restore that
resets all the registry values back to there state previous to your
programs installation. The user starts your application and *bam* is
greated by a JIT debugging window stating a null reference exception
occurred. The point is, prerequisites are often deleted after the
install - so your code should be ready and able to handle these
occurrences. This is why I believe the registry parts of an
application should initialize themselves, and not rely on a setup
utility.

Thanks,

Seth Rowe
 
I get it, but this is a non-issue in our environment. We control the
software at the client and the only time this registry key could be
overwritten would be by us.

Am I to assume then, based on the opposition to my original stated question,
that a registry key cannot be set by the msi installation process?

Assume nothing.

I honestly don't know that much about the advanced features of setup
projects. I know you can run scripts and modify registry entries for
web setup projects, so surely you can do the same with windows based
setups.

Thanks,

Seth Rowe
 
First run of what? there are many projects that might need it,
including MS Office files outside the project.

Whenever I install the solution, I must create it manually. If I
create it as part of the runtime I would have to replicate the code in
every project basically. I don't think that works.

Ok fair enough.. Like Seth, I won't claim to understand installer tech very
much but if I understand you correctly you have a "setup project" created
from within studio.

If this is the case then you should be able to hit a button in the soultion
explorer toolbar which looks like the regedit icon.

This button should launch a editor ( in the main window ) allowing you to
indicate registry entries that should be created when running the installer.

Does this help?
 
Back
Top