I have a WPF assembly in which I would like to embed five icons for different filetypes associated with my application. How can I embed these icons into my EXE?
@smoore @Groky @ChrisF, thank you. Unfortunately, this is not what I asked. I see that my question was quite vague 0_°. Let me rephrase the question:
I have icons, say Application.ico
, Document.ico
, etc. as resources in my WPF projects. I access these icons in most cases with the following:
<Image Source="/MyAssembly;component/Resources/Icons/Application.ico" />
That works every single time. I know that.
What my question is about is how can I use the same icons from Windows Explorer for file associations in the registry. I want to be able to access the icons with a path like:
C:\Program Files\MyApp\MyApp.exe,1
Like in how icons are associated with filetypes in HKEY_CLASSES_ROOT
.
AFAIK, I should use a resource file (.rc
), compile and merge it with my EXE. Something along the lines of:
101 RT_ICON Application.ico
102 RT_ICON Document.ico
// etc...
Is this the right way in WPF? Is there an alternative, especially since this method seems to lead to the erasure of the assembly version from my AssemblyInfo.cs
. I am still prepared to have to write the versioning info in the resource instead of the assembly's info.