Yak package automatically include include icon on creation possible?

Hi there,

I love Rhino creating the YAK-packages for me automatically.
Now that I have an icon I realized that the package does not include the icon automatically when I refer to it in Visual Studio. The rest of the information is used perfectly fine though.
This would mean that I always have to add the reference to the icon manually, right?

Am I missing something?
If not, is it possible to implement something like that.

Thanks,
T.

@curtisw @CallumSykes
Might this be a topic you can help with?

The automatic yak feature doesn’t include icons currently, you’d need to write your own task in the csproj for that.

Curtis and I do have ideas for improving the automatic yak packages and this is something we’d like to improve.

@CallumSykes thanks a lot.
Sounds intriguing, but not knowing how to write the task…
How hard would that be or me to do this?

I’m no expert on csproj tasks but the below should work, let me know if you have any issues.

Assuming you either
A - Ran dotnet new rhino -n <myproject> -yak
B - Checked the yak checkbox in the project wizard in Visual Studio

You should be able to find these 2 lines in your .csproj:

    <Exec Command="&quot;$(YakExecutable)&quot; spec" WorkingDirectory="$(OutputPath)" Condition="$(BuildYakPackage) == 'True'" />
    <Exec Command="&quot;$(YakExecutable)&quot; build" WorkingDirectory="$(OutputPath)" Condition="$(BuildYakPackage) == 'True'" />

Replace them with these lines:

    <Exec Command="&quot;$(YakExecutable)&quot; spec" WorkingDirectory="$(OutputPath)" Condition="$(BuildYakPackage) == 'True'" />

    <!-- Copy icon -->
    <Copy SourceFiles="$(MSBuildProjectDirectory)/icon.png" DestinationFolder="$(OutputPath)" Condition="$(BuildYakPackage) == 'True'" />

    <!-- Add icon to manifest.yml -->
    <WriteLinesToFile File="$(OutputPath)/manifest.yml" Lines="icon: icon.png" Overwrite="false" WriteOnlyWhenDifferent="true" />

    <Exec Command="&quot;$(YakExecutable)&quot; build" WorkingDirectory="$(OutputPath)" Condition="$(BuildYakPackage) == 'True'" />

The icon should now be included in the yak package.

@CallumSykes
Works!
Very nice, thank you!