【问题标题】:How to use NAnt to build with Azure DevOps and Git?如何使用 NAnt 通过 Azure DevOps 和 Git 进行构建?
【发布时间】:2019-11-07 12:50:03
【问题描述】:

我们设置了 NAnt 构建,当前通过命令行从 TFS 中提取源代码。我们正在切换到 Azure DevOps,据我了解,源代码提供者是 Git。我需要弄清楚如何通过命令行获取最新的代码,就像我们使用 TFS 所做的那样。

我到处研究过,虽然我可以看到一些 Git 命令行选项,但我不确定如何或用什么与 NAnt 一起使用。

我需要替换的内容如下所示:

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

您能否就 Azue DevOps 的构建选项向我提供建议?

【问题讨论】:

    标签: git command-line build azure-devops nant


    【解决方案1】:

    您可以添加以下内容以从 TFS 获取源。更多关于命令参数的详细信息,请查看此文档(https://docs.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>
    

    如果你转用Git,请参考Git命令(https://docs.microsoft.com/en-us/azure/devops/repos/git/command-prompt?view=azure-devops)。您可以使用 pull 或 fetch 命令来更新代码。在将 git 用于 Azure DevOps 之前,您需要通过 Azure Repos (https://docs.microsoft.com/en-us/azure/devops/repos/git/auth-overview?view=azure-devops) 进行身份验证。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-05
      • 2019-08-24
      • 2019-04-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多