Add Icon to Zero Touch Node

I already read that documentation before posting in the forum and I tried many different configurations because I was getting errors for every single try. For instance, if I insert this configuration which actually is the config that makes most sense to me, it still fails:

<GetReferenceAssemblyPaths TargetFrameworkMoniker=".NET, Version=v8.0">

You need to provide the following values:
<GetReferenceAssemblyPaths TargetFrameworkMoniker="net8.0, Version=v8.0">

1 Like

Still not working… I made your suggestion @Thomas_Mahon but I got the same error:

It is so weird because I updated Visual Studio to get everything up to date and I also reinstalled .NET 8 from the Microsoft website.

I am gonna leave here a ZIP file with the project just in case anyone wants to have a look at it and can provide another point of view after running the solution.

ClassLibrary1.7z (125.9 KB)

Cheers.

I just checked BimorphNodes and…I’m not doing what I suggested at all! In fact, I’m still able to use the old framework target for building the customization assembly.

This compiles and loads correctly in Revit 2025. I’m targeting .NET 8 before you ask.
<GetReferenceAssemblyPaths TargetFrameworkMoniker=".NETFramework, Version=v4.8">

Ok I didn’t realise you were still targeting .NET 4.8.

Your problem isn’t here, its actually your TargetFrameworkVersion property value in your Project properties. It should be:
<TargetFrameworkVersion>net48</TargetFrameworkVersion>

Also, you’re using the old style VS templates which are pretty bad compared to the latest ones. You can upgrade your projects, but I’ve always found this to be a pain, so what I do is simply create a new project using the latest .NET version (8), drag/drop all your folders from the old project into the new one, then you can make it backwards compatible with NET 4.8 like this:

	<PropertyGroup>
		<TargetFramework>net48</TargetFramework>
		<ImplicitUsings>enable</ImplicitUsings>
		<OutputType>Library</OutputType>
		<Nullable>enable</Nullable>
		<LangVersion>preview</LangVersion>
	</PropertyGroup>

I tried this approach same as BimorphNodes, targeting NET8 but building the customization assembly with <GetReferenceAssemblyPaths TargetFrameworkMoniker=".NETFramework, Version=v4.8"> but when I open DynamoSandbox and I try to insert the node (sayHello), it gets stuck and the software does nothing and shows up this error:

@Thomas_Mahon I think you got confused reading an older reply with another sample that I tried for .NET Framework targetin 4.8. For that sample everything worked just fine.

Currently, I am trying to do the same but targeting .NET8.0 and it is where I am coming across with some issues such as the creation of the customization assembly.

Regards.

Ah ok, in that case then, stick with net8.0.

This works for me using the latest template targeting NET 8 (not sure if that makes any difference):

<GetReferenceAssemblyPaths TargetFrameworkMoniker=".NETFramework, Version=v4.8">

2 Likes

I’m working on this now for a package and just found out that adding images in VisualStudio 2022 with the new SDK style of project does not add them as Base64. So “embedded in resx” is not an option. If I convert to base64 myself, edit the resx manually, the images work.

Is there a setting that tells visual studio to use images as base64?

1 Like

@john_pierson , you mean new SDK style but targeting NET8.0? or NET 4.8?

Targeting either. Adding images results in them not being base64 as demonstrated in my GIF.

I went ahead and just made a .resx generator in Rhythm. I will publish it soon. It takes an input directory and creates the .resx for you based on all the pngs within it.

The fact that this is still an issue and the documentation is six years old is ridiculous. I removed images from Rhythm back when 2.13 dropped because the node library icons went away for the top-level icon, and I figured why bother because I just used one icon for the whole package.

1 Like

Looking forward to your publication to see how you sort the issue out, @john_pierson. Thank you for everything you do for the community.

Although it worked for me the addition of icons with new SDK style and NET4.8 (video attached above), I spent my whole weekend trying to troubleshoot why the icons were not added when targeting NET8.0 with no success… :sweat: I swear I cannot remember how many different configurations I tried… my next try was gonna be reinstall VS 2022 and NET8 lol.

Cheers.

Yeah that is what is frustrating the heck out of me. So, this node will be in Rhythm shortly. Basically you just input your directory of Large and Small icons, the desired path for the .resx file and it will shoot it out for you with them all encoded as base64.

here is the code for now though:

and now I have a properly formatted resx file with all of my images:

5 Likes

I managed to make my solution multi-framework and generate the Nodes Icons correctly.

Below is what I have done.

IMPORTANT:
Dynamo needs a satellite Assembly to generate the nodes’ icons.

Two things were messing up to achieve this in the SDK Style csproj required by .net8

  1. The satellite DLL needs to be generated from a binary .resources file instead of a .resx file. To achieve this, according to the Dynamo documentation, it is necessary to use the <GenerateResource> Task.
    This Task calls a tool named ResGen.exe in the background to compile the .resx into .resources.

  2. The compilation of the satellite DLL was also getting messed up because the Dynamo documentation directs to use the <AL> (Assembly Linker) Task, but this only works in .NetFramework.
    In .net8, it’s necessary to use the C# compiler itself, with the <Csc> Task.

So here’s what I did to resolve each issue:

  1. I eliminated everything that was calling ResGen.exe to compile the .resources. Instead, now I use the terminal with resgen command to compile .resources file

  1. I created conditions for compiling the satellite Assembly based on the selected .net version.

Here is how I created the framework selection.

Those are my resources references on csproj

Since I will now need to generate the .resources file manually, I created an External Tool in Rider.

Basically, this calls a pre-configured executable.

This is useful to avoid having to remember the commands every time in the terminal.

In Visual Studio you need to call regen command in terminal manually.

Oh, one last thing.

With the implementation of this SDK Style for the csproj, many Windows-specific elements are no longer in the SDK, due to this cross-platform approach. So, to create resources in .net framework 4.8, it requires installing the package:

<PackageReference Include="System.Resources.Extensions" Version="8.0.0" />

and set the properties below on your project

<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>

3 Likes