LKBEN11669: How to add a runonce possibility to your visual studio setup project?


Symptom

You would like to install your software and run it once on logon.

Cause

This might be used for extra configuration.

Solution

Right click on your project, click on view and select Registry. Here you add an entry to your application. This can be done directly or with a link. (lnk)

HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce

You can prefix the RunOnce value name with an exclamation point to defer deletion of the value until the command runs. Without this prefix (!) your program will not be asked to run if the RunOnce operation fails.

You need to give:

  • a name (e.g. !myApplication)
  • a condtion (optional)
  • if it is transitive (false or true)
  • the Value (e.g. c:\program files\your_directory\myApplication.lnk)
  • the ValueType (e.g. vsdrvtString)

Have fun.

Disclaimer:

The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!

About the Author

Author: Wim Peeters - Keskon GmbH & Co. KG

Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.

Latest update: 08.06.2023