I am trying to add a custom icon to a Dynamo package. I have added a resource file, called ‘PackageImages.resx’ and I have referenced two icons, called “DefaultCustomNode.Large.png” and “DefaultCustomNode.Small.png”. They are both set with Persistence of type “Embedded in .resx” and there is no value set for Custom tool:
My solution is of type Microsoft.NET.Sdk and I have added the following lines to the csproj file:
<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>
just as specified in this repository: Creating Icons for Custom Nodes · DynamoDS/Dynamo Wiki · GitHub
I am working in VS 2022. Everything should be ok, but I keep getting this error:
I read this should be fixed by going to properties for the image and checking the Unblock tick mark after the error message, like this:
However, in my case, the file doesn’t seem to be blocked:
So what am I doing wrong?