vb.net - Create Event Log Source as part of installation - windows forms app, vs deployment project -


I have a vb.net window form which I am deploying as a visual studio deployment project. The application needs to write an event log in the Application log in Event Viewer. By stating the reason I need to create an event source during the installation process. Something like this to run as part of the installer

  if not event lodge. SOURCEXIST (My.Application.InfoPrintCamName) Event Logs CreteEventSource (My.app.InfoPontCam, "App") End if   

The code needs to be run with high privileges during installation. So my questions are:

  1. How can I execute that code as part of the installer?
  2. How do I get the UAC prompt to allow the installer to run as part of the installation?

    Adding an empty registry key for HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ services \ eventlog \ Application \ MY_CUSTOM_SOURCE_NAME_HERE works fine

Comments