tags:

views:

135

answers:

2

I want to create a setup in C#.NET as a trial version.So I want to save the date of installation in registry and to check for the trial version validity.I tried using the installer class.But I don't know the exact method to store the datetime of the installing product.It would be helpful if explained with code examples.

Thanks in advance

A: 

The most simple way to add the current date to the registry in a setup project is as follows:

  1. Right-click your setup project in the solution explorer, select 'View', select 'Registry'
  2. Open the HKEY_LOCAL_MACHINE, Software, [Manufacturer] key
  3. In the middle of the screen (where you see a Name / Value grid), right-click and select New, String Value
  4. Rename the New Value #1 to your liking and right-click and open the Properties Window
  5. In the properties window, most likely below the solution explorer, enter [Date] as Value, including the brackets!
  6. Build your setup, run the setup.exe from your debug/release dir and complete the setup.
  7. Open regedit, browse to HKEY_LOCAL_MACHINE\Software\(Your 'company' name)
  8. If all went right, you see now the current date in your Name/Value pair :). If not, reread and repeat the steps or comment my answer where and what went wrong
Webleeuw
A: 

Well, I think the Date needs to be encrypted in some way because it is used for the trial version check. In that case I would suggest using the Project Installer class instead of coding that in the Setup itself.

Add an installer class in your assembly and add Custom Action to the setup. In the Custom Action properties for your assembly, specify that you are having the project installer class. The installer class can have a number of events based like Committed, Rollback etc in which you can code your logic to save the Date.

A9S6