I have application that produces files. I would like to connect those files with application so that double-click on file launches my application.
Everything works properly except for annoyance that icon looks same like icon of my application. I would like to have one icon for application and one icon for it's documents.
DefaultIcon value in registry requires "app.exe,1" syntax where 1 is icon index. It seems that .NET resources are not Win32 resources.
I tried following but without success:
Only thing that worked is having icon file separated from executable and pointing to it. However, that seems to me like surrender.
Any ideas how to solve this?
Have you tried setting 2 as the icon index?
EDIT: I found a way but you have to do it again for every new build.
EDIT 2: Try this article: http://www.codeproject.com/KB/dotnet/embedmultipleiconsdotnet.aspx
If you are using the Wix toolset (http://www.wixtoolset.org) to install your application, you can get Wix to take care of the file type and document icon registration
Here is my magic Wix incantation:
<!-- Your executable -->
<File
Id="MaAppExe"
Name="MyApp.exe"
Source="MyApp.exe" KeyPath="yes" >
</File>
<!-- your document icon -->
<File
Id='IconMyAppDoc.ico'
Name='IconMyAppDoc.ico'
Source='$(var.MyApp.ProjectDir)\Resources\Images\Icons\docicon.ico' />
<-- File Extension and associated document icon -->
<ProgId
Id='MyApp.MyAppExtension'
Description='My App Data File'
Icon='IconMyAppDoc.ico'>
<Extension
Id='MyApp'
ContentType='text/plain'>
<Verb
Id='open'
Command='Open'
TargetFile="MyAppExe"
Argument='"%1"' />
</Extension>
</ProgId>
</Component>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With