0

I am using TFS 2015 Release to deploy Builds to DEV, QA, and UAT, environments. I am deploying a C# WPF application.

  1. I have made a change to an included database project where I have now included ".sql" scripts to the output directory in my Visual Studio Solution. I check in the changes, the build passes.
  2. I create a new release in my Release Pipeline, and use the newly created build.
  3. PROBLEM: my release pipeline fails the deployment on the release step "Download artifacts".

I require the newly included ".sql" files for extending our release pipeline so I need to find a way to include these files.

This is the "Download artifacts.log" file taken from the deployment step where it fails. Previous to the newly included ".sql" files this step would pass.

    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)

What I have tried I have reversed my code change, checked in the changes, built the application, and successfully released the application. being successful in the Download artifacts step.

I have tried two different ways of getting the ".sql" script files into the build artifacts folder

  1. I used an XCOPY command in the post-build event of the database project which copies the specific files to the build output path of the application.
  2. Alternatively I tried manually changing the ".sql" files setting Copy to Output Directory to Copy always

Both of these techniques copied the files I wanted into the build artifact.

Please let me know what I should try next. Thanks

JukeSpeets
  • 561
  • 5
  • 7
  • Don't publish to a fileshare. Change it to store the files in the TFS instance. Also, consider upgrading to a version of TFS that's not almost 5 years old. – Daniel Mann Sep 27 '19 at 15:27
  • @DanielMann What is wrong with publishing files to a file share? We publish our build and artifacts to a fileshare as a step in our automated CI build. That way we can use the artifacts for release definitions or manually installing the build on different QA systems.. We are also in the process of upgrading to DevOps 2019. – JukeSpeets Sep 30 '19 at 13:15

1 Answers1

0

Found the Problem,

The file path to the build artifacts was too long... When a release agent starts a job, it pulls all the linked build artifacts into the build agent's working folder.

In my case I was copying files that were nested in folders with longish names, and the script files themselves had really long names.

Solution

Shorten the file names somehow. XCOPY has a switch that shortens the filenames. This was fine to use in my case.

XCOPY /n - Creates copies by using the NTFS short file or directory names. /n is required when you copy files or directories from an NTFS volume to a FAT volume or when the FAT file system naming convention (that is, 8.3 characters) is required on the Destination file system. The Destination file system can be FAT or NTFS.

JukeSpeets
  • 561
  • 5
  • 7