TFS 2015版本管理-工件类型:FileShare错误:System.IO.FileNotFoundException:无法找到指定的文件

时间:2019-09-27 15:00:04

标签: tfs msbuild tfs-2015 azure-pipelines-release-pipeline release-management

我正在使用TFS 2015版本将内部版本部署到DEV,QA和UAT环境。 我正在部署C#WPF应用程序。

  1. 我对包含的数据库项目进行了更改,现在在其中包含了“ .sql”脚本以 我的Visual Studio解决方案中的输出目录。我签入 更改,构建就通过了。
  2. 我在发布管道中创建了一个新版本,并使用了     创建的版本。
  3. 问题:我的发布管道无法在该发布上进行部署     步骤“下载工件”。

我需要新包含的“ .sql”文件来扩展我们的发布渠道,所以我需要找到一种方法来包含这些文件。

这是从部署步骤中提取的“下载artifacts.log” 文件,该文件失败。在新添加的“ .sql”文件之前,此步骤将通过。

    2019-09-27T12:43:12.0760185Z Cleaning artifacts directory: C:\ST-BuildAgent\AgentA\9d128ed82…
    2019-09-27T12:43:12.2244465Z Cleaned artifacts directory: C:\ST-BuildAgent\AgentA\9d128ed82
    2019-09-27T12:43:12.2263995Z Number of linked artifacts to download: 2
    2019-09-27T12:43:12.2273760Z Starting artifacts download...
    2019-09-27T12:43:12.2390940Z Downloading linked artifact: Application Main - Continuous...
    2019-09-27T12:43:12.2390940Z Downloading artifact of type: Build
    2019-09-27T12:43:12.2400705Z Created artifact folder C:\ST-BuildAgent\AgentA\9d128ed82\Application Main - Continuous
    2019-09-27T12:43:12.2527650Z Preparing to get the list of available artifacts from build.
    2019-09-27T12:43:12.3631095Z Preparing to download artifact: Application Main - Continuous_20190927.2
    2019-09-27T12:43:12.3699450Z Artifact Type: FileShare
    2019-09-27T12:43:14.8404900Z Preparing to get the list of available artifacts from build.
    2019-09-27T12:43:14.8854090Z Preparing to download artifact: Application Main - Continuous_20190927.2
    2019-09-27T12:43:14.8854090Z Artifact Type: FileShare
    2019-09-27T12:43:15.9234285Z Preparing to get the list of available artifacts from build.
    2019-09-27T12:43:15.9790890Z Preparing to download artifact: Application Main - Continuous_20190927.2
    2019-09-27T12:43:15.9790890Z Artifact Type: FileShare
    2019-09-27T12:43:17.0171085Z Preparing to get the list of available artifacts from build.
    2019-09-27T12:43:17.0551920Z Preparing to download artifact: Application Main - Continuous_20190927.2
    2019-09-27T12:43:17.0551920Z Artifact Type: FileShare
    2019-09-27T12:43:18.0912585Z Preparing to get the list of available artifacts from build.
    2019-09-27T12:43:18.1518015Z Preparing to download artifact: Application Main - Continuous_20190927.2
    2019-09-27T12:43:18.1518015Z Artifact Type: FileShare
    2019-09-27T12:43:18.1879320Z Error: System.IO.FileNotFoundException: Unable to find the specified file.
    2019-09-27T12:43:18.1879320Z    at Microsoft.TeamFoundation.Release.Windows.Implementation.FileSystemFile..ctor(String fullPath)
    2019-09-27T12:43:18.1889085Z    at Microsoft.TeamFoundation.Release.Windows.Implementation.FileSystemDirectory.<>c.<GetFiles>b__8_0(String fullPath)
    2019-09-27T12:43:18.1889085Z    at System.Linq.Enumerable.<>c__DisplayClass7_0`3.<CombineSelectors>b__0(TSource x)
    2019-09-27T12:43:18.1889085Z    at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
    2019-09-27T12:43:18.1889085Z    at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
    2019-09-27T12:43:18.1898850Z    at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
    2019-09-27T12:43:18.1898850Z    at Microsoft.TeamFoundation.DevOps.Diagnostics.DiagnosticsPolicyExecutor.Execute[T](Func`1 func, String methodName)
    2019-09-27T12:43:18.1898850Z    at Microsoft.TeamFoundation.Release.ArtifactRepository.FileShare.FileShareArtifact.DownloadArtifact(ArtifactDefinition artifactDefinition, String dropLocation, String localFolderPath)
    2019-09-27T12:43:18.1898850Z    at Microsoft.TeamFoundation.Release.ArtifactRepository.Build.BuildArtifact.DownloadArtifact(BuildArtifact buildArtifact, ArtifactDefinition artifactDefinition, String localFolderPath, BuildHttpClient buildClient, Int32 buildId)
    2019-09-27T12:43:18.1908615Z    at Microsoft.TeamFoundation.Release.ArtifactRepository.Build.BuildArtifact.Download(ArtifactDefinition artifactDefinition, String localFolderPath)
    2019-09-27T12:43:18.1908615Z    at Microsoft.TeamFoundation.Release.ArtifactRepository.Common.AgentArtifactDownloader.Download(ArtifactDefinition artifactDefinition, Uri workingFolder)
    2019-09-27T12:43:18.1908615Z    at Microsoft.TeamFoundation.DistributedTask.Plugin.Release.ReleaseJobExtension.<>c__DisplayClass19_0.<DownloadArtifacts>b__0()
    2019-09-27T12:43:18.1908615Z    at Microsoft.TeamFoundation.Release.Windows.Implementation.RetryExecutor.Execute(Action action)
    2019-09-27T12:43:18.1918380Z    at Microsoft.TeamFoundation.DistributedTask.Plugin.Release.ReleaseJobExtension.DownloadArtifacts(ITaskContext downloadArtifactTaskContext, IJobContext context, IList`1 agentArtifactDefinitions, Uri artifactsWorkingFolder, String teamProjectId, IDictionary`2 savedSettings)
    2019-09-27T12:43:18.1918380Z    at Microsoft.TeamFoundation.DistributedTask.Plugin.Release.ReleaseJobExtension.DownloadArtifactsWrapper(IJobContext context, IJobRequest job, CancellationToken cancellationToken, ITaskContext downloadArtifactTaskContext, String teamProjectId, Uri artifactsWorkingFolder, Int32 releaseId, IDictionary`2 savedSettings)

我尝试过的事情 我撤消了代码更改,签入更改,构建了应用程序,并成功发布了该应用程序。在“下载工件”步骤中获得成功。

我尝试了两种不同的方法来将“ .sql”脚本文件放入构建工件文件夹中

  1. 我在数据库的构建后事件中使用了XCOPY命令 将特定文件复制到的生成输出路径的项目 该应用程序。
  2. 或者,我尝试手动更改“ .sql”文件设置 复制到输出目录始终复制

这两种技术都将我想要的文件复制到了构建工件中。

请让我知道下一步该怎么做。 谢谢

1 个答案:

答案 0 :(得分:0)

发现问题

构建工件的文件路径太长...当发布代理启动作业时,它将所有链接的构建工件拉到构建代理的工作文件夹中。

就我而言,我正在复制嵌套在具有长名的文件夹中的文件,而脚本文件本身的名称确实很长。

解决方案

以某种方式缩短文件名。 XCOPY有一个可以缩短文件名的开关。就我而言,这很好。

XCOPY / n-使用NTFS短文件或目录名称创建副本。当您将文件或目录从NTFS卷复制到FAT卷或目标文件系统上需要FAT文件系统命名约定(即8.3个字符)时,/ n 是必需的。目标文件系统可以是FAT或NTFS。