Use this as a pre-build step, either as part of your TeamCity/TFS/etc process or by adding it to the
pre-build step of your project, like the following example. Assuming you have the script saved in a
directory build
located in the same directory as your .sln file:
<Project>
<!-- usual other stuff here //-->
<!-- ... //-->
<PropertyGroup>
<PreBuildEvent>powershell -ExecutionPolicy RemoteSigned -File $(SolutionDir)build\gitinject.ps1 $(ProjectDir)</PreBuildEvent>