 |
 | Warning: This breaks File Properties and msi Upgrades stevenmcohn | 4:15 2 Mar '10 |
|
 |
Very good article and I appreciate your investigation. I started using this in one of my own projects to embed a second icon for my program's Start menu Uninstall item (my program knows how to uninstall itself given a /u parameter.)
However, by using a .res file and changing the Properties "Resources" to use a Resource file, you've now overridden the information specified in the AssemblyInfo.cs file. Most of the [assembly: ...] attribute directives are now ignored.
This means that attributes such as AssemblyCompany and AssemblyCopyright are no longer visible in the File Properties dialog. Worse, this breaks the upgrade feature of Deployment project .msi setups files since we no longer have a link to AssemblyVersion. By switching the project Properties Resources back to a simple icon, the compiler once again considered the AssemblyInfo attributes and the .msi upgrade started working.
So while I'm sure this is useful for many people, many others should be aware of these caveates.
Kind Regards
P.S. For my multi-icon dilema, I ended up deploying a second icon in the install directory that I could bind to my Uninstall Start menu item. It means there's an extra .ico file out there but OK.
|
|
|
|
 |
 | There is no resources box rocketman221 | 15:08 15 Dec '09 |
|
 |
There is no resources box on the application tab. And putting it in the resources tab doesn't work.
|
|
|
|
 |
 | Great... but how to extract them? J. Elliott | 12:11 5 May '09 |
|
 |
This is a fabulous article, but now that I have a .res file with four icons in it, how do I get any of them other than the first to show up in Windows Explorer?
Specifically I've got one big project that I build four different ways with four Configurations. The code is nearly identical for all four builds except where I use #if...#endif to check for one of four conditional compilation symbols assigned to each configuration.
Now instead of changing the Resources / Icon and Manifest / Icon setting between each build, I have just one entry in the Resources / Resource file field, which indicates my Win32Resource I built thanks to your article. However, I want to extract a certain one of the four icons inside it for each of my 4 configurations.
I think this article stopped short of showing how to do that. Thanks!
Jeff Elliott Pres & Owner, C Guru, Inc.
|
|
|
|
 |
|
 |
From what I remember the first icon in the list will be the one which is displayed in Windows Explorer (i.e. the one with the lowest index). The others should be visible if you're using explorer to create a shortcut to the program then you can specify which icon you want to use in the shortcut properties. Usually gives the file path followed by a , and then the icon index.
J. Elliott wrote: I think this article stopped short of showing how to do that. Thanks!
Would be a good expansion, e.g. different icons for debug builds etc. I'm not sure how this could be accomplished, perhaps by a custom build action or pre/post build tasks.
One method I can think of off the top of my head would be:
- Create a folder with all the resource files with one named for each configuration
- In the pre-build event write a small script which copies
Resources\$(ConfigurationName).res to a default location
- Link the default location as the resource file for the project
I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder
|
|
|
|
 |
|
 |
Good ideas. I'll try them shortly. (My first post here ever, BTW!)
Jeff Elliott Pres & Owner, C Guru, Inc.
|
|
|
|
 |
 | Good Tutorial ctw313 | 0:57 8 Nov '08 |
|
 |
Finally an Icon Embedding tutorial that's TO THE POINT!
|
|
|
|
 |
|
 |
Thanks, I prefer short and to the point stuff. My pet hate is screen casts, mainly because I'm a fast reader and can read much faster than most people can speak...
|
|
|
|
 |
 | for Visual Studio 2008 NevzatAdagide | 13:58 18 Oct '08 |
|
|
 |
|
 |
So you prefer doing 6 additional steps for every rebuild of the project as opposed to a couple to start with?
I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder
|
|
|
|
 |
 | Import of .res file not available in VS 2008 t_anjan | 9:23 11 Feb '08 |
|
 |
In the Resources tab of the Project Properties page, there is no option to import .res files. The only workaround I could find was to use a /win32resource compiler switch. More details in this thread[^].
|
|
|
|
 |
|
 |
Take a look at this[^] screenshot.
Sorry I don't have VS2005 around so can't point it out.
|
|
|
|
 |
 | Does not appear to work with 32-bit icons. Ineffable | 10:43 1 Aug '07 |
|
 |
Is there anyway to embed 32-bit icons?
|
|
|
|
 |
|
 |
I think that that may be a problem with VS2005, if you try and edit 32 bit icons it complains about it. Unfortunately I don't have the time at the moment to investigate.
Do you get an error message or anything in particular?
|
|
|
|
 |
 | Good one! Vasudevan Deepak Kumar | 0:26 13 Jul '07 |
|
 |
Good one and informative too.
|
|
|
|
 |
 | Can't add Win32 resource into VB.NET project [modified] ProJee | 23:34 12 Jul '07 |
|
 |
Step 2.2:
There's no "Resources" group box in the properties of VB.NET project (and I've never seen it there before)...
modified on Tuesday, May 5, 2009 4:10 AM
|
|
|
|
 |
|
 |
It's actually a tab along the left side:
Application* Compile Debug References Resources
Settings Signing Security Publish
|
|
|
|
 |
 | Interesting... AnandChavali | 20:26 12 Jul '07 |
|
 |
Nice one dude..
Thanks and Regards, Anand.
|
|
|
|
 |
|
 |
Ah well, C# it is then . I hadn't checked but the win32 resource thing is a feature of the C# compiler. I don't know if there's one for VB.NET. Normally if you were doing this from the command line you'd do
csc.exe /win32res:application.res
|
|
|
|
 |
|
 |
Sorry that wasn't meant to be posted under your message but the one above.
|
|
|
|
 |
 | Nice One Paul Conrad | 19:24 12 Jul '07 |
|
 |
Ed,
Very nice, quick article. One worthy of going into my CP blog for good reading
Paul
"I've seen more information on a frickin' sticky note!" - Dave Kreskowiak
|
|
|
|
 |