Reputation: 6416
Is there any guaranteed way to get the location of the ".appref-ms" file of some application other than the executing application?
Upvotes: 5
Views: 2412
Reputation: 11877
Yes, you can. Try this out:
shortcutName = string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Programs),
"\\", company, "\\", description, ".appref-ms");
where company is the Publishing Company in the Options dialog, and Description is the Product Name in the Options dialog.
I use this code generically inside my application by pulling the assembly information. I make sure the Assembly Company always matches the Publishing Company, and the Assembly Description always matches the Product Name.
Upvotes: 8