Csproj, Yak package after compilation


Do you have a template csproj file that creates a Yak package after the Release build?


<Project Sdk="Microsoft.NET.Sdk">

    <!-- These properties are used by the "Yak spec" command -->
        <Version>...</Version> <!-- Or <InformationalVersion>...</InformationalVersion> -->
        <Company>...</Company> <!-- Or [assembly: PlugInDescription (DescriptionType.Organization, ...)] -->
        <!-- manifest.yml/url is only set by  [assembly: PlugInDescription (DescriptionType.WebSite, ...]-->



    <PropertyGroup Condition="$(Configuration) == 'Release'">
    <Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="$(Configuration) == 'Release'">
        <Exec Command="echo Generate Yak package: $(Version)" />
        <Delete Files="$(ProjectDir)$(OutDir)manifest.yml" />
        <Exec WorkingDirectory="$(ProjectDir)$(OutDir)" Command='"C:\Program Files\Rhino 7\System\Yak.exe" spec' />
        <Exec WorkingDirectory="$(ProjectDir)$(OutDir)" Command='"C:\Program Files\Rhino 7\System\Yak.exe" build' />


Thanks for providing this example!

I’d recommend only running the yak build command in the project’s post-build step. The yak spec command can be run manually and then the manifest.yml file should be edited, stored with the project and copied to the build directory before running yak build.

<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="$(Configuration) == 'Release'">
    <Copy SourceFiles="manifest.yml" DestinationFolder="$(OutDir)" />
    <!-- ... -->

Additionally, specifying version: $version in the manifest.yml file will prompt yak.exe to inject the plug-in’s version number at build time.

Ok, however, I understand that I’m not using the spec command as it was intended.
having to change a version number in several different places is a risk of error.
But that was before I knew version: $version.
thank you for the answer !