Adding/changing the icon for self-extracting zip output

Aug 25, 2009 at 1:26 PM


I currently am creating a self-extracting zip and I am wondering if there is a way to change the icon associated with the final output .EXE that is created.  I don't really need an elegant way of being able to pass a reference to this into the self-extractor or anything.  If there is just a way of hardcoding a reference for what .ico to use during the exe's generation that would work.  I searched around some online but couldn't find exactly what I was looking for.

I can't seem to paste a screenshot of what the icon looks like in here but that really shouldn't matter.






Aug 25, 2009 at 4:21 PM

Hmm - no there's currently no way to set the icon for the Self-extracting archive.

Are you saying, you would like the icon to be something reasonable, just not what it is now? 

or, instead, do you want a way to set an arbitrary icon when you save the thing?

or.. something else?

Aug 25, 2009 at 4:49 PM

Well, I guess an ideal solution would be to let the caller pass in or set what they the icon to be when making the call to SaveSelfExtractor().  Really, my problem is, I just don't know how to change it myself in the code.  I would be ok if I knew how to manually set it at runtime to some icon I have added to the solution.  I will always be using the same icon.  Maybe if we can just figure out how to set it to something else, then each user can manually go in and change the reference.

Have you seen the icon that ends up with the .exe as it is now?  I'm guessing I don't have the ability to add images to posts.



Aug 25, 2009 at 5:10 PM

Yep, I just looked at the icon with the generated Self-extractor.  It's the default .NET application icon, pretty nondescript.

I just made a change so that the SFX gets a "zip file" icon by default, and also lets you set it to an arbitrary icon value.

I will make available a version with that change, for you to try, shortly.

you can include images in your posts - you have to edit the HTML of your post to do it.  And, the images have to be hosted "somewhere else"  .  Try 

I use a screenshot tool called cropper (available free on codeplex) that snaps a screen image, saves it, and then uploads it to  It's handy for this kind of thing.

here's an image I snapped while composing this reply:


Aug 25, 2009 at 5:13 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Aug 25, 2009 at 5:17 PM

If only everyone worked as quickly as you......thanks again and I'll keep an eye for the new version to try out.


Aug 25, 2009 at 6:10 PM

running some tests now...

Aug 25, 2009 at 6:39 PM

Ok, Fred, try out v1.8.4.22.  It should do what you want:

  • there's a reasonable default icon now for SFX files
  • You can specify an icon file when saving an SFX

Please let me know if this works for you.


Aug 25, 2009 at 7:30 PM

Sweet.  I think your idea to use the typical zip icon as default is a good one.  After thinking about it, I'm pretty sure that's what I'll end up using.  I'll test out adding in a custom one also.  Can you let me know which files were affected in work item 8616 so I can do some diff's and see exactly what you did?



Aug 25, 2009 at 7:35 PM

The only changes for this fix were in the file ZipFile.SaveSelfExtractor.cs .


Aug 25, 2009 at 7:42 PM

Yea...I should have looked before I asked.  Testing now.  I'll let you know if I have any problems.


Aug 25, 2009 at 7:54 PM

ok great