Custom Icon for Custom Package in VS2019

Hi there,

I am trying to create a default large/small custom icon for a package I have begun to develop. I’m coming in with very little C# knowledge so am relying on guides quite heavily. I’ve downloaded and installed Visual Studio 2019 (VS2019) and installed all the modules except for mobile device related ones. I’ve updated my Windows SDK to latest also.

I’m aware this question has come up many times, and the answer typically leads the askers here; https://github.com/DynamoDS/Dynamo/wiki/Creating-Icons-for-Custom-Nodes

My goal if I can get this process to work is to also create a video guide to show other developers how to achieve this process (I usually prefer visual/video guides, so want to make one for others).

It appears that I’m either getting the workflow wrong vs. the written instructions, or the way visual studio works has changed a bit since this was written in 2015.

If anyone has any experience with this workflow using VS2019, I’d appreciate some insight on the following issues I’m having;

  1. I’m making a new class library for C# as the guide suggests, but which type should I be using (.NET Standard, .NET Core or .NET Framework)? I’ve been testing with .NET Standard typically.

  2. No issues creating the resource file in the solution (PackageImages.Resx), however I cannot find any reference to ‘strong typing’ which it says needs to be disabled. Has this been integrated into VS2019 since this guide was made? I can’t find any information in web trawling on this specific term.

  3. No issues adding the default custom node .png file to the resources file, however once it is loaded, the ‘persistence’ field is greyed out and cannot be changed to ‘embedded in res.x’. See attached what I see at this stage. As a result I don’t think my .csproj file is properly built and prepared for the addition of the package customization addition in notepad.

I’ve downloaded and tried working with the Clockwork VS project from github, but it relies on an older version of the SDK so I need to work with a newly made VS2019 class library I think.

Any help is appreciated, apologies in advance for my ‘green-ness’. I’ve been at this for about 2 hours now!

DefaultCustomNode.Large DefaultCustomNode.Small


I made custom icons for my other packages last year. I used the Clockwork VS project as a basis. I can‘t remember if I already had VS 2019 installed at the time, but perhaps this project works for you:

1 Like

Hi Andreas, it appears to be a clash with VS2019 still, Windows SDK and the additional target block of text being added. Thanks for linking me to the example though, was worth a shot!

I think there’s a muddleup on my machine between Windows SDK, my registry entries and the net framework/build text. Bit over my head so I’ll probably shelf it for now. I did manage to get the resources embedded at least so got to the last step in the end…

If you still have the VS setup available on your machine and find time, I’ve attached my icons I’m trying to add to the package customization dll. I know you’re really busy though so no pressure, but if you do find a brief second to build them into a dll (if it works on your side) that would be amazing.

Either way, thanks, and I’ll class it as a solution seeming it’s on my side by the looks of it.

DefaultCustomNode.Large DefaultCustomNode.Small

Gavin, I seem to have issues as well building the icon solution with VS2019. Will keep you posted if I manage to figure out what is going on.

1 Like

hmm

might be worth looking at how this is done in DynamoRevit - after all - it’s very similar. Note the inclusion of sdkToolsPath property.

1 Like

Thanks for trying it out Andreas, glad it isn’t just me!

I’ll delve a bit deeper, and if I come across the cause I’ll let Jacob and team know so the workflow can be potentially updated from the 2015 version.

Edit: scratch that, Michael found the fix

You legend! Adding and modifying this line worked!!!

It worked :slight_smile:

Success

The target insert code including SDK reference is below. @JacobSmall not sure if this is worth adding to the guide on adding package icons? I’m going to make a video on my channel showing how to do this process in either case!

   <Target Name="BeforeBuild">
    <GetReferenceAssemblyPaths TargetFrameworkMoniker=".NETFramework, Version=v2.0">
      <Output TaskParameter="FullFrameworkReferenceAssemblyPaths" PropertyName="FrameworkAssembliesPath" />
    </GetReferenceAssemblyPaths>
	<GenerateResource SdkToolsPath="$(TargetFrameworkSDKToolsDirectory)" UseSourcePath="true" Sources="$(ProjectDir)PackageImages.resx" OutputResources="$(ProjectDir)PackageImages.resources" References="$(FrameworkAssembliesPath)System.Drawing.dll" />
    <GenerateResource UseSourcePath="true" Sources="$(ProjectDir)PackageImages.resx" OutputResources="$(ProjectDir)PackageImages.resources" References="$(FrameworkAssembliesPath)System.Drawing.dll" />
    <AL TargetType="library" EmbedResources="$(ProjectDir)PackageImages.resources" OutputAssembly="$(OutDir)Package.customization.dll" />
  </Target>
  <Target Name="AfterBuild">
  </Target>

the github wiki is open source so you should be able to make the edit without being a member of the dynamo org, please add what you found!

2 Likes

Done, thanks! Happy to contribute :slight_smile:

My VS project is saved here if it helps anyone:

1 Like