定位应用程序根目录的正确目标文件夹值是多少?

问题描述 投票:0回答:1

我正在尝试将文件从

Views
目录复制到 Web 服务器解决方案的根目录。我正在使用针对 Web 服务器的发布管道
IIS Web App Deploy task
。在部署之前,我尝试将
app_offline.htm
文件从
Views
目录复制到我的应用程序的根目录。

所以我有任务:

  1. IIS Web 应用程序管理
  2. 提取文件
  3. 复制文件:将app_offline.htm复制到根目录
  4. IIS Web 应用程序部署
  5. PS脚本:从根目录中删除app_offline.htm

问题是

Copy files
无法将
app_offline.htm
复制到根目录。

我有以下 YAML:

steps:
- task: CopyFiles@2
  displayName: 'Add app_offline.htm to /'
  inputs:
    SourceFolder: '$(System.DefaultWorkingDirectory)/extracted'
    Contents: 'Views\app_offline.htm'
    TargetFolder: /

它在 Views 文件夹中找到

app_offline.htm

但是它不会将其复制到根文件夹,无论我把什么作为

Target Folder
app_offline.htm
都不会复制到根文件夹。

每次:

  1. 无法复制文件(可能是因为找不到
    Target Folder
  2. 或报告

文件 C: zagent[...] xtracted\Views pp_offline.htm 已存在于 D:\Inetpub[...]\Views pp_offline.htm

因此它找到的任何目标都会读取为当前文件位置(例如

/Views/
文件夹),无法映射根目录。

查看其旁边的目标和数字,以查看其结果报告,如上所述。

我已尝试将目标文件夹设置为:

/ <- 2

\ <- 2

$(Build.Repository.LocalPath)/ <- 1

$(Build.Repository.LocalPath)\ <- 1

$(Build.Repository.LocalPath) <- 1

D:\Inetpub\[...] <- 2

D:\Inetpub\[...]\ <- 2

../ <- 1

$(Agent.BuildDirectory) <- 1

$(Pipeline.Workspace) <- 1

定位应用程序根目录的正确

Target Folder
值是多少?

azure-devops azure-pipelines azure-pipelines-release-pipeline
1个回答
0
投票

文件 C: zagent[...] xtracted\Views pp_offline.htm 已存在于 D:\Inetpub[...]\Views pp_offline.htm

根据错误消息。该文件已存在于目标文件夹中。您可以尝试在 CopyFiles 任务中启用

Overwrite
选项。它将替换目标文件夹中的现有文件。

此外,您需要确保构建服务帐户具有访问目标文件夹的正确权限(写入)。

- task: CopyFiles@2
  inputs:
    SourceFolder: '$(System.DefaultWorkingDirectory)/extracted'
    Contents: 'Views\app_offline.htm'
    TargetFolder: '/'
    OverWrite: true
© www.soinside.com 2019 - 2024. All rights reserved.