Search code examples
c#texteditordefault

C# Setting my application as default app


I'm a novice programmer and have developed a notepad replacement application for my own needs (with some more features). When I double click a .txt file (or a customizable extension such as .abc), I want the file to run in my application just like notepad. I read about File Association with programs but I didn't get much of it.

Can someone point me to how I would do this? Just give me a few ideas, I would really like to do this and have an option for my users to set the application as the default text editor. Help would be much appreciated.


Solution

  • If you are using click-once deployment (i.e. "publish" in VS for a windows exe), you can specify file associations there, and it will do everything for you. I can't guarantee that it'll take precedence over notepad, though. For that you might need a proper installer...

    MSDN shows how