[C#] Need help adding registry entries during setup

Status
Not open for further replies.

Whoo

The Wise One
2,480
2008
282
0
Hey all,

I'm working on a C# application for image uploading, everything is going great but the only thing that I can't really figure out is how to add registry entries.

I need to add an extra item to the windows context menu during the setup/initial run of the application (preferably during setup).

I need to add several keys for certain file-extensions under the HKEY_CLASSES_ROOT.

I could do this every time the application is ran, but that would not be performant. It would also require the application to be ran as an administrator. The setup of an application always requires administrator privileges so it would be cool if I could add some sort of class to run during installation.

I have already looked into an installer class and all but Im really newb in making setup/deployment project so if any of you could guide me in the right direction.

Basicly what I need is:
-During setup registry entries must be made (And I also need the location of where the application is installed so a .reg file is a no-go unless I can pass arguments to it).

Thanks for the future help :-)
Whoo
 
5 comments
If you create a Deployment Project in Visual Studio you have an editor to manage file types and other registry stuff. Have a look at that, it's fairly easy.

[slide]http://i.imgur.com/M9LG8.png[/slide]
 
Thanks for the reply Hyperz although I have looked several times at the registry view when creating such a project I need to store the location of the application (after it has been installed) as a value of a key that is going to be made.

Any way to get that value?

Btw an example is HKEY_CLASSES_ROOT/pngfile/shell/MyAppNameHere/command
The default value for command will contain the location of my application ;)
 
Because when right clicking on certain files with a certain extension the name of my application must appear in the windows context menu. In order to launch an application when clicking it then the location of the application must be stored in the registry else windows doesn't know what to do when my application is clicked in the context menu.

Thanks
 
Status
Not open for further replies.
Back
Top