The "GenerateResource" task failed unexpectedly when building docker windows image in DevOps - azure-devops

I feel like something has broken in the latest version of mcr.microsoft.com/dotnet/sdk:6.0 as this was working just a few weeks ago, but I thought I'd post here to see if anyone has had similar problems and if there is a fix/workaround.
When trying to build, the following error is thrown
Step 9/18 : RUN dotnet publish "Test.Service.csproj" -c Release -o /app/publish
---> Running in f763996ec9e3
MSBuild version 17.3.0+92e077650 for .NET
Determining projects to restore...
Restored C:\src\Test.Service\Test.Service.csproj (in 15.18 sec).
Restored C:\src\Test.Core\Test.Core.csproj (in 15.18 sec).
Restored C:\src\Test.DataLayer\Test.DataLayer.csproj (in 1.74 sec).
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: The "GenerateResource" task failed unexpectedly. [C:\src\Test.DataLayer\Test.DataLayer.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {7B8A2D94-0AC9-11D1-896C-00C04FB6BFC4} failed due to the following error: 80040154 Class not registered (0x80040154 (REGDB_E_CLASSNOTREG)). [C:\src\Test.DataLayer\Test.DataLayer.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: at System.RuntimeTypeHandle.AllocateComObject(Void* pClassFactory) [C:\src\Test.DataLayer\Test.DataLayer.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions) [C:\src\Test.DataLayer\Test.DataLayer.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions) [C:\src\Test.DataLayer\Test.DataLayer.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: at System.Activator.CreateInstance(Type type) [C:\src\Test.DataLayer\Test.DataLayer.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: at Microsoft.Build.Tasks.GenerateResource.IsDangerous(String filename) [C:\src\Test.DataLayer\Test.DataLayer.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: at Microsoft.Build.Tasks.GenerateResource.Execute() [C:\src\Test.DataLayer\Test.DataLayer.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\src\Test.DataLayer\Test.DataLayer.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [C:\src\Test.DataLayer\Test.DataLayer.csproj]
The command 'cmd /S /C dotnet publish "Test.Service.csproj" -c Release -o /app/publish' returned a non-zero code: 1
Here is the DockerFile:
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["NuGet.Config", "NuGet.Config"]
COPY ["Test.Service/Test.Service.csproj", "Test.Service/"]
COPY ["Test.DataLayer/Test.DataLayer.csproj", "Test.DataLayer/"]
COPY . .
WORKDIR "/src/Test.Service"
FROM build AS publish
RUN dotnet publish "Test.Service.csproj" -c Release -o /app/publish
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS final
WORKDIR /app
EXPOSE 80
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Test.Service.dll"]
Building works when using the ubuntu-latest agent, but I can't make it work using windows-latest. I've also tried windows-2019 with the same problem.

I have the same issue in my Azure pipeline build using a win2022. It just started within the last few weeks. I can build the container locally fine.
Update: I tested removing the .resx file in my project and now it builds fine.
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: The "GenerateResource" task failed unexpectedly.
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {7B8A2D94-0AC9-11D1-896C-00C04FB6BFC4} failed due to the following error: 80040154 Class not registered (0x80040154 (REGDB_E_CLASSNOTREG)).

For now I'm using FROM mcr.microsoft.com/dotnet/sdk:6.0.200 AS build.
I'm hoping a fix will be released at some point. It should be fixed along with this isue: https://github.com/dotnet/msbuild/issues/7946

Related

Snyk Security Scan task in Azure Pipeline

I am trying to use Snyk Security Scan task in Azure Pipeline (Classic). My Application runtime is .Net and framework is ASP.Net 4.4.1 . There is no issue regarding authentication as i had create valid service connection of Snyk.
When i am running my pipeline it is giving error "Could not detect supported target files in D:\a\1\s".
log of failed Snyk Security Scan task:
##[debug]debug=undefined
##[debug]task result: Failed
** We have a problem! :( **
##[error]There was an error when attempting to execute the process 'C:\Program Files\nodejs\npm.cmd'. This may indicate the process failed to start. Error: spawn C:\windows\system32\cmd.exe ENOENT
##[debug]Processed: ##vso[task.issue type=error;]There was an error when attempting to execute the process 'C:\Program Files\nodejs\npm.cmd'. This may indicate the process failed to start. Error: spawn C:\windows\system32\cmd.exe ENOENT
There was an error when attempting to execute the process 'C:\Program Files\nodejs\npm.cmd'. This may indicate the process failed to start. Error: spawn C:\windows\system32\cmd.exe ENOENT
##[debug]Processed: ##vso[task.complete result=Failed;]There was an error when attempting to execute the process 'C:\Program Files\nodejs\npm.cmd'. This may indicate the process failed to start. Error: spawn C:\windows\system32\cmd.exe ENOENT
I had this same problem and needed to take advantage of the "Custom path to manifest file to test" field with an absolute location of the packages file: C:\agent_work[buildId]\s[solution folder][project folder]\packages.config
This was running on a private build server.

How to solution the following error when build EmulatorPkg ?

when I run build -p EmulatorPkg\EmulatorPkg.dsc -t VS2019 -a X64, it show the following error
LINK : warning LNK4108:ָ /ALIGN ûָ /DRIVERӳܲ
LINK : warning LNK4001: δָļʹÿ
LINK : warning LNK4068: δָ /MACHINEĬΪ X86
LINK : error LNK2001: ޷ⲿ _ModuleEntryPoint
d:\edk2\edk2\Build\EmulatorX64\DEBUG_VS2019\X64\WinHost.lib : fatal error LNK1120: 1 ޷ⲿ
NMAKE : fatal error U1077: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\
MSVC\14.25.28610\bin\Hostx86\x64\link.exe": ش롰0x460
Stop.
Building ... d:\edk2\edk2\EmulatorPkg\BootModePei\BootModePei.inf [X64]
build.py...
: error 7000: Failed to execute command
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.25.28610\bin
\Hostx86\x86\nmake.exe /nologo tbuild [d:\edk2\edk2\Build\EmulatorX64\DEBUG_VS2019\X64\EmulatorPkg\Win
\Host\WinHost]
build.py...
: error F002: Failed to build module
d:\edk2\edk2\EmulatorPkg\Win\Host\WinHost.inf [X64, VS2019, DEBUG]
- Failed -
Build end time: 22:18:35, Apr.07 2020
Build total time: 00:00:13
but when build MdeModulePkg/MdeModulePkg.dsc, it not have any error.
The error was caused by missing support for VS2019 in this module.
Support was added upstream in commit 998d4c98b7c6 ("EmulatorPkg/WinHost: Add link flags for VS2019 tool chains.").

Cannot build .Net Core in WSL with mount volume

Describe the bug
I am using VS Code, WSL and .net core 3.0 preview to build one sample web API project in WSL that is stored in C drive. But It throws an exception with a strange error
"/mnt/c/temp/test/test.csproj" (default target) (1:7) ->
(_CreateAppHost target) ->
/usr/share/dotnet/sdk/3.0.100-preview9-014004/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(370,5): error MSB4018: The "CreateAppHost" task failed unexpectedly. [/mnt/c/temp/test/test.csproj]
/usr/share/dotnet/sdk/3.0.100-preview9-014004/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(370,5): error MSB4018: System.IO.IOException: Invalid argument [/mnt/c/temp/test/test.csproj]
/usr/share/dotnet/sdk/3.0.100-preview9-014004/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(370,5): error MSB4018: at System.IO.MemoryMappedFiles.MemoryMappedView.CreateView(SafeMemoryMappedFileHandle memMappedFileHandle, MemoryMappedFileAccess access, Int64 requestedOffset, Int64 requestedSize) [/mnt/c/temp/test/test.csproj]
/usr/share/dotnet/sdk/3.0.100-preview9-014004/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(370,5): error MSB4018: at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateViewAccessor(Int64 offset, Int64 size, MemoryMappedFileAccess access) [/mnt/c/temp/test/test.csproj]
/usr/share/dotnet/sdk/3.0.100-preview9-014004/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(370,5): error MSB4018: at Microsoft.NET.HostModel.AppHost.HostWriter.<>c__DisplayClass2_0.<CreateAppHost>g__RewriteAppHost|0() [/mnt/c/temp/test/test.csproj]
/usr/share/dotnet/sdk/3.0.100-preview9-014004/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(370,5): error MSB4018: at Microsoft.NET.HostModel.RetryUtil.RetryOnIOError(Action func) [/mnt/c/temp/test/test.csproj]
/usr/share/dotnet/sdk/3.0.100-preview9-014004/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(370,5): error MSB4018: at Microsoft.NET.HostModel.AppHost.HostWriter.CreateAppHost(String appHostSourceFilePath, String appHostDestinationFilePath, String appBinaryFilePath, Boolean windowsGraphicalUserInterface, String assemblyToCopyResorcesFrom) [/mnt/c/temp/test/test.csproj]
/usr/share/dotnet/sdk/3.0.100-preview9-014004/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(370,5): error MSB4018: at Microsoft.NET.Build.Tasks.CreateAppHost.ExecuteCore() in /_/src/Tasks/Microsoft.NET.Build.Tasks/CreateAppHost.cs:line 68 [/mnt/c/temp/test/test.csproj]
/usr/share/dotnet/sdk/3.0.100-preview9-014004/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(370,5): error MSB4018: at Microsoft.NET.Build.Tasks.TaskBase.Execute() in /_/src/Tasks/Common/TaskBase.cs:line 38 [/mnt/c/temp/test/test.csproj]
/usr/share/dotnet/sdk/3.0.100-preview9-014004/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(370,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/mnt/c/temp/test/test.csproj]
/usr/share/dotnet/sdk/3.0.100-preview9-014004/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(370,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/mnt/c/temp/test/test.csproj]
To Reproduce
Steps to reproduce the behavior:
1. Using this version of ASP.NET Core '3.0.100-preview9' both on Window 10 and WSL
2. In Window 10
+ cd c:\temp
+ dotnet new webapi
3. Go to WSL, (/mnt/c/temp)
3. Run dotnet build
4. See error
Expected behavior
Run "dotnet build" successfully and can run/debug application in WSL from VSCode
Setting up dotnet on a fresh installation of Ubuntu (20.04) under WSL 2 on Windows 10 I had the above The "CreateAppHost" task failed unexpectedly. error along with a bunch file-system related permission errors when running dotnet build - however sudo dotnet build worked just fine...
My solution was to close/restart all running WSL instances, from a windows command prompt list all running instances;
C:\> wsl -l --running
Windows Subsystem for Linux Distributions:
docker-desktop-data (Default)
Ubuntu
docker-desktop
Then close the running one you wish to use for dotnet;
C:\> wsl --terminate Ubuntu
And then re-run/re-start the distro;
C:\> wsl -d Ubuntu
And then by magic dotnet build worked without the addition of sudo and also worked via vscode WSL remote plugin... hopefully this simple 'reboot solution' helps someone else!

Why am I getting "Exit code 100 returned from process: file name 'tf'"

I'm using Azure DevOps (visualstudio.com) and trying to get a Linux Build Agent up and running on a local server. This was working previously, but I upgraded the Linux server from Ubuntu 16.04 to 18.04. That broke my previous build agent.
So I removed the previous build agent and installed an up to date one. The new one registered easily, but when I try and run a build, it fails to check out sources.
Anybody know what might cause this problem, or where I can go for help? I don't manage our Azure DevOps. I'm just trying to get the Linux part working as it was.
Edit: I should note that running ./externals/tee/tf produces zero output (and returns with the same 100 code). Maybe it has something to do with java. I'm running Java(TM) SE Runtime Environment (build 12.0.2+10).
##[debug]Evaluating condition for step: 'Checkout'
##[debug]Evaluating: SucceededNode()
##[debug]Evaluating SucceededNode:
##[debug]=> True
##[debug]Result: True
##[section]Starting: Checkout
==============================================================================
Task : Get sources
Description : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version : 1.0.0
Author : Microsoft
Help : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
##[debug]Processed: ##vso[plugininternal.updaterepositorypath alias=__designer_repo;]/home/***/myagent/_work/1/s
##[debug]Repository requires to be placed at '/home/***/myagent/_work/1/s', current location is '/home/***/myagent/_work/1/s'
Prepending PATH environment variable with directory containing 'tf'.
##[debug]Processed: ##vso[task.prependpath]/home/***/myagent/externals/tee
##[debug]PATH: '/home/***/myagent/externals/tee:/home/***/bin:/home/***/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin'
Querying workspace information.
##[debug]tf workspaces -format:xml "-collection:https://mydomain.visualstudio.com/" -jwt:*** -noprompt
##[debug]Starting process:
##[debug] File name: 'tf'
##[debug] Arguments: 'workspaces -format:xml "-collection:https://mydomain.visualstudio.com/" -jwt:*** -noprompt'
##[debug] Working directory: '/home/***/myagent/_work/1/s'
##[debug] Require exit code zero: 'True'
##[debug] Encoding web name: ; code page: ''
##[debug] Force kill process on cancellation: 'False'
##[debug] Redirected STDIN: 'False'
##[debug] Persist current code page: 'False'
##[debug] Keep redirected STDIN open: 'False'
##[debug] High priority process: 'False'
##[debug]Updated oom_score_adj to 500 for PID: 1921.
##[debug]Process started with process id 1921, waiting for process exit.
##[debug]STDOUT/STDERR stream read finished.
##[debug]STDOUT/STDERR stream read finished.
##[debug]Finished process 1921 with exit code 100, and elapsed time 00:00:03.3458546.
##[error]Exit code 100 returned from process: file name 'tf', arguments 'workspaces -format:xml "-collection:https://mydomain.visualstudio.com/" -jwt:*** -noprompt'.
##[debug]Processed: ##vso[task.logissue type=error;]Exit code 100 returned from process: file name 'tf', arguments 'workspaces -format:xml "-collection:https://mydomain.visualstudio.com/" -jwt:*** -noprompt'.
##[debug]Processed: ##vso[task.complete result=Failed;]
##[debug] at Agent.Plugins.Repository.TeeCliManager.WorkspacesAsync(Boolean matchWorkspaceNameOnAnyComputer)
at Agent.Plugins.Repository.TfsVCSourceProvider.GetSourceAsync(AgentTaskPluginExecutionContext executionContext, RepositoryResource repository, CancellationToken cancellationToken)
at Agent.Plugins.Repository.CheckoutTask.RunAsync(AgentTaskPluginExecutionContext executionContext, CancellationToken token)
at Agent.PluginHost.Program.Main(String[] args)
##[section]Finishing: Checkout
When I saw that the tf command produced no output, I was pretty sure it had to be a java problem. I had tried many different versions of java and none of them worked. But with Oracle java 1.8.0_221 it finally worked.
I downloaded the .tar.gz file, extracted it, and overwrote the /usr/bin/java* symlinks to point to the 1.8 copies and then it worked.

Windows Machine File Copy won't work without shared folder

I am using VSTS Release Management. The first step is to do a "Windows Machine File Copy". The settings are below. This fails when doing the robocopy with an error message of "Access Denied". The file path shown in the settings below gets translated to \\machine\e$\xxxx\TargetFolder. Why am I getting access denied? I don't get this message if I create a shared folder on the target folder and change the destination folder to: \\machine\TargetFolder. The Admin user is a local admin on the machine.
My question is why do I need to setup a shared folder in order to get this to work. Why can't it use the admin share (i.e. \\machine\e$\xxxx\TargetFolder)
Here is the log. The source and destination servers are both Win 2012R2 servers. UAC is turned off on the destination server. I have tried /B and /ZB as arguments and that didn't work.
2017-02-20T12:21:10.4545267Z Downloading artifact
2017-02-20T12:21:11.4375965Z Cleaning artifacts directory: C:\VSTS_agent\ReleaseManagementVSTS\r1\a
2017-02-20T12:21:11.6306012Z Cleaned artifacts directory: C:\VSTS_agent\ReleaseManagementVSTS\r1\a
2017-02-20T12:21:11.6396014Z Starting artifacts download...
2017-02-20T12:21:11.6426015Z Downloading linked artifact Release Build of type Build...
2017-02-20T12:21:11.6486018Z Ensuring artifact folder C:\VSTS_agent\ReleaseManagementVSTS\r1\a\Release Build exists and is clean.
2017-02-20T12:21:11.6856039Z Preparing to get the list of available artifacts from build
2017-02-20T12:21:12.0926382Z Preparing to download artifact: release
2017-02-20T12:21:12.1066374Z Artifact Type: ServerDrop
2017-02-20T12:21:12.5536635Z Caching items under 'release' in the file container...
2017-02-20T12:21:12.7186787Z Caching complete. (165 ms)
2017-02-20T12:21:17.8480056Z Download complete.
2017-02-20T12:21:17.8500047Z 51 placed file(s): 51 downloaded, 0 empty
2017-02-20T12:21:17.8500047Z 11 MB downloaded at 2188 KB/sec. Download time: 00:00:05.0976254. Parallel download limit: 4.
2017-02-20T12:21:17.8510054Z Downloaded linked artifact Release Build
2017-02-20T12:21:17.8510054Z Finished artifacts download
2017-02-20T12:21:17.8610039Z ##[section]Finishing: Download Artifacts
2017-02-20T12:21:17.8690051Z ##[section]Starting: Copy files from $(System.DefaultWorkingDirectory)/Release Build/release
2017-02-20T12:21:17.9680113Z ==============================================================================
2017-02-20T12:21:17.9680113Z Task : Windows Machine File Copy
2017-02-20T12:21:17.9680113Z Description : Copy files to remote machine(s)
2017-02-20T12:21:17.9690126Z Version : 1.0.39
2017-02-20T12:21:17.9690126Z Author : Microsoft Corporation
2017-02-20T12:21:17.9690126Z Help : [More Information](https://go.microsoft.com/fwlink/?linkid=627415)
2017-02-20T12:21:17.9690126Z ==============================================================================
2017-02-20T12:21:18.0380182Z Preparing task execution handler.
2017-02-20T12:21:19.8101219Z Executing the powershell script: C:\VSTS_agent\ReleaseManagementVSTS\_tasks\WindowsMachineFileCopy_xxxx\1.0.39\WindowsMachineFileCopy.ps1
2017-02-20T12:21:24.0233892Z Copy started for - 'machine'
2017-02-20T12:21:28.8116953Z
2017-02-20T12:21:28.8116953Z -------------------------------------------------------------------------------
2017-02-20T12:21:28.8116953Z ROBOCOPY :: Robust File Copy for Windows
2017-02-20T12:21:28.8116953Z -------------------------------------------------------------------------------
2017-02-20T12:21:28.8116953Z
2017-02-20T12:21:28.8146952Z Started : Monday, February 20, 2017 7:21:28 AM
2017-02-20T12:21:28.8156949Z 2017/02/20 07:21:28 ERROR 5 (0x00000005) Getting File System Type of Destination \\machine\E$\xxx\TargetFolder\
2017-02-20T12:21:28.8156949Z Access is denied.
2017-02-20T12:21:28.8156949Z
2017-02-20T12:21:28.8156949Z
2017-02-20T12:21:28.8156949Z Source : C:\VSTS_agent\ReleaseManagementVSTS\r1\a\Release Build\release\
2017-02-20T12:21:28.8167052Z Dest - \\machine\E$\xxx\TargetFolder\
2017-02-20T12:21:28.8167052Z
2017-02-20T12:21:28.8167052Z Files : *.*
2017-02-20T12:21:28.8167052Z
2017-02-20T12:21:28.8167052Z Options : *.* /S /E /DCOPY:DA /COPY:DAT /R:1000000 /W:30
2017-02-20T12:21:28.8167052Z
2017-02-20T12:21:28.8167052Z ------------------------------------------------------------------------------
2017-02-20T12:21:28.8186939Z
2017-02-20T12:21:28.8196951Z 2017/02/20 07:21:28 ERROR 5 (0x00000005) Creating Destination Directory \\machine\E$\xxx\TargetFolder\
2017-02-20T12:21:28.8196951Z Access is denied.
2017-02-20T12:21:28.8196951Z
2017-02-20T12:21:28.8977003Z \\machine was deleted successfully.
2017-02-20T12:21:28.8977003Z
2017-02-20T12:21:28.9177039Z ##[error]System.Management.Automation.RuntimeException: Copying failed for resource : machine
2017-02-20T12:21:28.9177039Z Copying failed. Consult the robocopy logs for more details. ---> System.Management.Automation.RuntimeException: Copying failed for resource : machine
2017-02-20T12:21:28.9177039Z Copying failed. Consult the robocopy logs for more details.
2017-02-20T12:21:28.9177039Z --- End of inner exception stack trace ---
2017-02-20T12:21:28.9177039Z at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
2017-02-20T12:21:28.9177039Z at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
2017-02-20T12:21:28.9177039Z at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
2017-02-20T12:21:28.9177039Z at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-02-20T12:21:28.9177039Z at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-02-20T12:21:28.9187021Z at Microsoft.TeamFoundation.DistributedTask.Handlers.LegacyVSTSPowerShellHost.VSTSPowerShellHost.Main(String[] args)
2017-02-20T12:21:28.9407042Z ##[error]LegacyVSTSPowerShellHost.exe completed with return code: -1.
2017-02-20T12:21:28.9427038Z ##[section]Finishing: Copy files from $(System.DefaultWorkingDirectory)/Release Build/release
2017-02-20T12:21:28.9507042Z ##[section]Finishing: Release
This issue was resolved by using an Active Directory account. This fixed the issue of not being able to Robocopy with the admin share. This worked on machines that the AD user had access, and for machines where the AD didn't have access but where a local admin windows account was setup with the same name as the AD account.