How to use NAnt to build with Azure DevOps and Git?

1k Views Asked by At

We have NAnt builds set up that currently pulls the source code from TFS via the command line. We are switching over to Azure DevOps and from what I understand, the source code provider is Git. I need to figure out how to pull down the latest code via a command line as we did with TFS.

I've researched everywhere and while I can see some Git command line options, I'm not sure how or what to use with NAnt.

What I need to replace looks something like this:

get TFSProjectName /recursive /version:${alterVersion} /login:userName, password

Could you please advise me on the build options with Azue DevOps?

1

There are 1 best solutions below

0
Lu Mike On

You can add following content for get the source from TFS. More details about the command parameter, please see this document(https://learn.microsoft.com/en-us/azure/devops/repos/tfvc/get-command?view=azure-devops).

<?xml version="1.0"?>
<project name="TFUse_GetFiles" default="GetTFSFiles">
<target name="GetTFSFiles" >
  <exec program="C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\TF.exe">
<arg value="get" />
    <arg value="/recursive" />
    <arg value="/login:username,password " />
    <arg value="$/Projects/dir/Main" />
<arg value="/force" />
  </exec>
</target> 
</project>

If you turned to use Git, please refer to Git command(https://learn.microsoft.com/en-us/azure/devops/repos/git/command-prompt?view=azure-devops). You can use pull or fetch command to update the code. Before using the git for Azure DevOps, you need to be authenticated with Azure Repos (https://learn.microsoft.com/en-us/azure/devops/repos/git/auth-overview?view=azure-devops).