It's very simple.
create a get_authors.sh (Mine is in the root but could also be a folder for build scripts. That's probably where I will put it when I create an example to go with this post.
One line of code in get_authors.sh script file - I tried to put the code in the csproj but because of the percent symbol it was easier to put it in a script.
git log --format='%ae' | grep -v noreply | grep -v outlift | sort -u | tr '\n' ', '
then add this fragment to your csproj file somewhere near the top
<Target Name="SetAuthors" BeforeTargets="InitializeSourceControlInformation">
<Exec Command="bash ../get_authors.sh" ConsoleToMSBuild="True" IgnoreExitCode="False">
<Output PropertyName="Authors" TaskParameter="ConsoleOutput" />
</Exec>
</Target>
In the section where the Authors tag is change that to
<PropertyGroup>
<Authors>$(Authors)</Authors>
Now the Nuget package Authors value is always up to date.
Easy peasy.
Top comments (0)