0

I am making a single exe application, that is linked in multiple Right-Click menus.

It is VB.Net application, using Net Framework 4.0 , Visual Studio 2019.

Each of those items needs a different icon.

How do I expose icons inside my exe, so they are available in Right-Click menu items and shortcuts without using post-build hackery?

I mention post-build as hackery, cos some anti-virus might not like the change in the signature that comes with messing about with the exe as a post-build step.

What I tried:

Adding png and ico versions of icons to My.Resources Adding png and ico versions of icons using Project -> Add -> Existing Item -> selecting files Using ImageMagick to combine multiple icons in to one ico file

Open the project script in the editor by right-clicking on the project and selecting Unload Project, then right clicking on the project and selecting Edit . Add the following element to the project script, replacing ExeName with the name of the project.

    <PropertyGroup>
   <Win32Resource>ExeName.res</Win32Resource>
</PropertyGroup>

What I want (example using explorer.exe): enter image description here

What do I have: No idea

MFY60
  • 3
  • 3
  • "How do I expose icons inside my exe, so they are available in Right-Click menu items and shortcuts without using post-build hackery?" - if you want icons you can use from within WinForms there's nothing wrong with using RESX. Do you mean to say you want icons that can be used for things like Windows Explorer shortcut icons and the like? – Dai Feb 19 '21 at 20:12
  • "I mention post-build as hackery, cos some anti-virus might not like the change in the signature that comes with messing about with the exe as a post-build step." - **this is not a real problem**. You should already have your project build output directories excluded from anti-virus search folders. Also, executables don't have signatures by default - you need to explicitly run `signtool` for that. .NET's strong-naming *might* be an issue - but you generally don't need to strong-name entrypoint executables, only libraries. – Dai Feb 19 '21 at 20:13
  • [Adding multiple Icons (Win32-Resource) to .NET-Application](https://stackoverflow.com/a/8914810/7444103). If it's worth it. These Icons probably don't need to be part of the executable itself. Maybe a standard .dll that contains the Icons. – Jimi Feb 19 '21 at 20:14
  • yes i want to use windows explorer context menu and although i tried all the methods on google i got no results. sorry for the bad language. – MFY60 Feb 20 '21 at 08:33

0 Answers0