【发布时间】:2019-11-21 02:55:01
【问题描述】:
我想在更新我的项目的主分支时使用 VSTS 来构建和部署我的应用程序(到 FTP)。我有下面的脚本。它的工作原理是它触发并构建但随后无法部署,因为它找不到文件并且我不知道要输入什么值。我收到以下错误。
VSTS 构建时,构建文件放在哪里?
我看过 youtube,但所有的例子都是旧的,并不能反映 VSTS 现在是如何工作的,所以我完全被卡住了。这里没有文章可以反映 VSTS 现在是如何工作的,Microsoft 页面也没有帮助。
我要审查的文章已经不多了,现在几乎是在猜测,所以非常感谢任何帮助。
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
steps:
- script: dotnet build --configuration $(buildConfiguration)
displayName: 'dotnet build $(buildConfiguration)'
- task: FtpUpload@2
inputs:
credentialsOption: 'inputs'
serverUrl: 'ftp://xxxxxxx.xxxxxxxx.xxxxx/'
username: 'xxxxxxxxx'
password: 'xxxxxxxxxx'
rootDirectory: '/'
filePatterns: '**'
remoteDirectory: '/'
clean: false
cleanContents: true
preservePaths: false
trustSSL: false
我改成了这个
rootDirectory: $(Agent.BuildDirectory)
并尝试过
rootDirectory: $(Build.StagingDirectory)
现在构建成功,但现在我收到此错误/警告。没有部署任何东西。
【问题讨论】:
-
您不会将任何内容复制到“$(build.stagingdirectory)”,因此不会有任何内容要上传
-
您必须添加复制任务或指向项目的构建输出
-
只是想看看下面的方法是否能帮助你抓住成功的管道。如果对您的问题没有帮助,请随时在下面发表评论:-)
-
手动,我可以发布到本地文件夹,然后压缩/解压缩到我的主机。我希望的是,当 VSTS 进行构建时,它会将文件放在发布位置的某个文件夹(类似)中,然后我可以添加一个任务或其他东西来完成复制位。我只是不知道发布的文件如何或去哪里
-
好吧,好像知道你有什么问题了。在这个问题中,您面临的困惑是不知道
dotnet build步骤完成后文件/文件夹在哪里?那么,这条线索你被rootDirectory误导了吗?
标签: azure-devops azure-pipelines-release-pipeline