Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4001434
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:54:16+00:00 2026-05-20T07:54:16+00:00

I’ve a C# .net 4 application, I’m starting to create the installer. The installed

  • 0

I’ve a C# .net 4 application, I’m starting to create the installer.

The installed program works fine, but my customer want that the application start with window(it’s an “Always of top” toolbar which help them to manage their call).

I thought to create a “Class Installer”, and in it insert a key in the registry.

I’ve two problems:

First: How can I find the executable path? It can change between installation. I found somewhere a Application.ExecutablePath, but it seems it located into Application.Window.Forms so I think its not compatible with WPF

Second: I need to insert this key in the registry of the local machine. Is there a way in a windows installer to specify that the user must have admin rights?

Here is the code I started:

RegistryKey rkApp = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
rkApp.SetValue("CstStart", ???);

Thank you very much for your help!

EDIT: I found that I can pass to my Custom action some data, with :

/DIR=”[TARGETDIR]\”

in the CustomActionData.

Normally it’s said I can retrieve it through the

this.Context.Parameters["DIR"];

But…. it seems that in my installer class, this.Context is null 🙁

EDIT2: The Context was null because I was doing this in the constructor, I’m now doing this in the event this.AfterInstall and now I get a context, which seems to contains a var “assemblypath” which contains exactly the path I need.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T07:54:17+00:00Added an answer on May 20, 2026 at 7:54 am

    My assumption is you’re working from a Setup project here…..

    one way to do this – I’m not saying it is the best but it is probably the easiest – is to do the following:

    In the “File System” tab, right click on “File System on Target Machine”, “Add Special Folder”, “User’s Startup Folder” and such folder appears on the list. Next, get a shortcut to your project output (by right clicking) and drag that shortcut into the Startup folder.

    Last of all, since you want this for all users, go into the Deployment Project Properties and set “InstallAllUsers” to true.

    Now, there is a caveat with this approach, in that the app does not start when Windows starts, but when someone logs on. From what you say of your project (a UI app) this may be ok.

    If you really want to go hacking the registry you could look at creating a custom action dll. This is something where you can write pretty much what you like, and at the end of the install process the setup program will call into your dll so you can do your stuff. You can pass things like the path of the executable as a parameter into the dll (which you would pick up from the installer dialog, not from any object). I won’t go into this is detail as there must be loads on the web about this.

    You should be aware that there is a finite amount of information you can pass into the dll – might be as low as 256 chars if memory serves. You’ll probably be ok with just a path but when you start doing more….

    As regards detecting whether a user is a local Admin, that is a bit more tricky, if only because the custom action dll gets run at the end of the installation rather than at the start – so you could write code to find out what groups the current user is in, but the chances are you’d have blown up before that code could run. I don’t believe – in a Microsoft Setup project at least – that it is possible to know this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.