Friday, March 30, 2012

Icons for Custom Tasks won't show up.

All aspects of my custom task work well except for the icon!

I have included the .ico in the assembly as an "Embedded Resource" and the icon has both 16X16 and 32X32 images. I have edited the IconResource property of the DtsTask attribute as follows:

IconResource="MyNamespace.MyDLLName.MyIconName.ico",

Where the output assembly is called "MyNamespace.MyDLLName.dll".

Has anybody got this working before? The Icon just never shows (I get the default blue square task icon).

Thanks in advance.

IconResource=”SSIS2K5.Samples.Tasks.CryptoTask.TaskIcon.ico”,

The IconResource parameter points

to the icon to be used in the Toolbox. It is not required. If not provided, the designer uses

a default icon. However, if you do provide this, the name of the resource must be

“TaskIcon” and you must provide the fully qualified name.

Have you named the icon "TaskIcon.ico"?

Kirk Haselden
Author "SQL Server Integration Services"

|||

Thanks Kirk,

Exactly what I needed!

I didn't see anything in the documentation about the "TaskIcon.ico" name requirement, but I imagine it must be there somewhere... so thanks again

Actually, I just thought of something - I have two custom tasks (and both their UIs) in the same Assembly. I am guessing that this means that both of the tasks will need to have the same icon. Can you think of any reason, other than modular deployment / maintenance advantages, for keeping the tasks in separate Assemblies?

|||

The restriction is that the filename and the default namespace must match the IconResource string, it does not have to be the literal TaskIcon.ico

The most likely cause is that the two do not match up correctly. Try this article-

How to add an icon to your component
(http://www.sqlis.com/default.aspx?22)

|||For tasks, I believe it does need to be the name "TaskIcon.ico" for it to show correctly in the toolbox unless something's changed in the code.|||

Someone changed it. I updated the IncrementTask sample to include an icon.

1 - Open project and select Add Existing Item, select any icon you have.

2 - Set Icon file name, I chose MyIcon.ico

3 - Set properties of icon file, changing the Build Action to Embedded Resource

4 - Add the IconResource property to the existing DtsTask attribute in the code file-

DtsTask
(
DisplayName = "IncrementTaskCS",
Description = "IncrementTask Sample",
IconResource = "Microsoft.Samples.SqlServer.Dts.MyIcon.ico",

Sample project here - http://www.sqlis.com/download/IncrementTaskWithMyIcon.zip

No comments:

Post a Comment