0

I have created one setup file in visual studio 2010 for windows forms ,also inserted SerialNumberTemplate Property In that setup ,now I am trying to allot 1 month duration period for this setup ,but If I store the start time using Registrykey and check it using some code , than how should i add this code in that setup ,or is there any other way with which I can achieve this ,any better way to do this?

I could save start date something like this and check for end date ,but how to merge it in that setup? What is the correct way

RegistryKey regkey = Registry.CurrentUser;           
DateTime dt = DateTime.Now;
string onlyDate = dt.ToShortDateString(); // get only date not time

regkey.SetValue("Install", onlyDate); //Value Name,Value Data
regkey.SetValue("Use", onlyDate); //Value Name,Value Data

Thanks in advance for any help

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Durga
  • 1,283
  • 9
  • 28
  • 54

1 Answers1

0

Create a registry item in the Registry view in the IDE and give it the value in the setup project.

Like here

But to test the value if for instance one month has pasted it is better to test this in the startup process of your app and close it if the time expired.

Also to prevent someone from just turning the time back on his machine I would add the check every time the app starts and just log the day's remaining and then write a logic to prevent abuse

Community
  • 1
  • 1
Jester
  • 3,069
  • 5
  • 30
  • 44
  • In Registry view I see 5 Folders, in which folder I should create it and give it the value in the setup project ,as i am new to this can u please explain me,I have seen the link provided by you ,But I am not getting it as clearly that how do I do it – Durga Aug 22 '13 at 06:37