C#C
C#3y ago
Nacio

❔ Saving current commit information to a file

I'm trying to save the current commit's information using this in the .csproj
    <Target Name="PreBuild" BeforeTargets="PreBuildEvent">
        <Exec Command="git log -1 --pretty=%&lt;25&gt;H%&lt;25&gt;n%&lt;25&gt;an%&lt;25&gt;n%&lt;25&gt;ae%&lt;25&gt;n%&lt;25&gt;cn%&lt;25&gt;n%&lt;25&gt;ce%&lt;25&gt;n%&lt;25&gt;cI%&lt;25&gt;n%&lt;25&gt;s &gt; &quot;$(ProjectDir)\CurrentCommit&quot;"/>
    </Target>

but it just keeps saying The system cannot find the file specified., does that mean it can't find the git command or actually the file,
or maybe there's a better way to get the commit info?

git log -1 --pretty=%H%n%an%n%ae%n%cn%n%ce%n%cI%n%s > ".\CurrentCommit" works just fine when run in a regular terminal
Build log: https://pastebin.com/raw/2dpKPdq5
Was this page helpful?