Reputation: 19810
I'm trying to add Git check-in as part of my MSBuild script. I want to:
The build script is in ./Build/ (where . is the solution folder).
I'm using:
<Target Name="Committed" DependsOnTargets="SignedInstaller">
<Exec Command=""$(GitInstallationFolderPath)cmd\git.exe" --git-dir=..\.git --work-tree=.. commit -m "$(Changes)""/>
<Exec Command=""$(GitInstallationFolderPath)cmd\git.exe" --git-dir=..\.git --work-tree=.. push"/>
<Exec Command=""$(GitInstallationFolderPath)cmd\git.exe" --git-dir=..\.git --work-tree=.. tag -a v$(VersionNumber) -m "$(Changes)""/>
<Exec Command=""$(GitInstallationFolderPath)cmd\git.exe" --git-dir=..\.git --work-tree=.. push -- tags"/>
</Target>
The custom properties are all OK.
The first commit exits with 1 and breaks the build.
I'm not sure if I just need to tweak this, or if I'm going about it all wrong, so advice would be welcome. I need to do some to add any new files to Git too - just haven't got that far yet. I do want to stick with MSBuild, though as we have a lot of scripts now. I just want to remove my SVN targets and move to Git.
Upvotes: 3
Views: 4856
Reputation: 5642
Unlike the limited features of the GitTasks found in MSBuild Extensions, there seems to be more general purpose stuff in the Community Tasks.
GitBranch A task to get the name of the branch or tag of git repository
GitClient A task for Git commands.
GitCommits A task for git to retrieve the number of commits on a revision.
GitDescribe A task for git to get the most current tag, commit count since tag, and commit hash.
GitPendingChanges A task for git to detect if there are pending changes
GitVersion A task for git to get the current commit hash.
Upvotes: 2