NUKE Build in Azure DevOps Build Pipeline Failing - azure-devops

So I have implemented the NUKE build system in my solution, and everything 100% works locally.
Out in Azure DevOps it's a different story, my YAML task looks like this:
- task: CmdLine#2
displayName: 'NUKE Build'
inputs:
script:
.\src\build package --cfg $(buildConfiguration) --pak $(Build.ArtifactStagingDirectory)
And NUKE does run, but it fails with an error stating it couldn't locate my solution file:
Expected file to exist: D:\a\1\s\**\*.sln
Here is the entire command line log output:
2022-04-08T18:39:07.9969860Z ##[section]Starting: NUKE Build
2022-04-08T18:39:08.0228304Z ==============================================================================
2022-04-08T18:39:08.0228652Z Task : Command line
2022-04-08T18:39:08.0228978Z Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
2022-04-08T18:39:08.0229274Z Version : 2.201.1
2022-04-08T18:39:08.0229490Z Author : Microsoft Corporation
2022-04-08T18:39:08.0230495Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
2022-04-08T18:39:08.0230888Z ==============================================================================
2022-04-08T18:39:09.5867757Z Generating script.
2022-04-08T18:39:09.6086899Z Script contents: shell
2022-04-08T18:39:09.6117246Z .\src\build package --cfg Release --pak D:\a\1\a
2022-04-08T18:39:09.6712303Z ========================== Starting Command Output ===========================
2022-04-08T18:39:09.7222712Z ##[command]"C:\Windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "D:\a\_temp\ec061a9c-d293-42ca-8b24-3d57ab43d6b1.cmd""
2022-04-08T18:39:10.1964079Z PowerShell Desktop version 5.1.20348.558
2022-04-08T18:39:11.9025685Z Microsoft (R) .NET Core SDK version 6.0.201
2022-04-08T18:39:12.1269858Z
2022-04-08T18:39:12.1299946Z Welcome to .NET 6.0!
2022-04-08T18:39:12.1300642Z ---------------------
2022-04-08T18:39:12.1301057Z SDK Version: 6.0.201
2022-04-08T18:39:12.1301258Z
2022-04-08T18:39:12.1301590Z ----------------
2022-04-08T18:39:12.1302080Z Installed an ASP.NET Core HTTPS development certificate.
2022-04-08T18:39:12.1303932Z To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only).
2022-04-08T18:39:12.1304429Z Learn about HTTPS: https://aka.ms/dotnet-https
2022-04-08T18:39:12.1305954Z ----------------
2022-04-08T18:39:12.1306300Z Write your first app: https://aka.ms/dotnet-hello-world
2022-04-08T18:39:12.1306678Z Find out what's new: https://aka.ms/dotnet-whats-new
2022-04-08T18:39:12.1307948Z Explore documentation: https://aka.ms/dotnet-docs
2022-04-08T18:39:12.1308586Z Report issues and find source on GitHub: https://github.com/dotnet/core
2022-04-08T18:39:12.1309267Z Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
2022-04-08T18:39:12.1311891Z --------------------------------------------------------------------------------------
2022-04-08T18:39:27.0014563Z ##[warning]Exception has been thrown by the target of an invocation.
2022-04-08T18:39:27.1770000Z [90m18:39:26[0m[90m [[0m[33;1mWRN[0m[90m] [0mException has been thrown by the target of an invocation.[0m
2022-04-08T18:39:27.1771426Z System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.[0m
2022-04-08T18:39:27.1773524Z ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.[0m
2022-04-08T18:39:27.1774228Z ---> System.ArgumentException: Expected file to exist: D:\a\1\s\**\*.sln (Parameter 'path')[0m
2022-04-08T18:39:27.1774784Z [90m at Nuke.Common.Assert.FileExists(String path, String message, String argumentExpression)[0m
2022-04-08T18:39:27.1775284Z [90m at Nuke.Common.IO.TextTasks.ReadAllLines(String path, Encoding encoding)[0m
2022-04-08T18:39:27.1775809Z [90m at Nuke.Common.ProjectModel.SolutionSerializer.DeserializeFromFile[T](String solutionFile)[0m
2022-04-08T18:39:27.1776522Z [90m --- End of inner exception stack trace ---[0m
2022-04-08T18:39:27.1777060Z [90m at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)[0m
2022-04-08T18:39:27.1778369Z [90m at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)[0m
2022-04-08T18:39:27.1779002Z [90m at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)[0m
2022-04-08T18:39:27.1779785Z [90m at Nuke.Common.ProjectModel.SolutionAttribute.GetValue(MemberInfo member, Object instance)[0m
2022-04-08T18:39:27.1782574Z [90m at Nuke.Common.ValueInjection.ValueInjectionAttributeBase.<>c__DisplayClass0_0.<TryGetValue>b__0()[0m
2022-04-08T18:39:27.1783085Z [90m --- End of inner exception stack trace ---[0m
2022-04-08T18:39:27.1783634Z [90m at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)[0m
2022-04-08T18:39:27.1784428Z [90m at System.Delegate.DynamicInvokeImpl(Object[] args)[0m
2022-04-08T18:39:27.1784965Z [90m at System.Delegate.DynamicInvoke(Object[] args)[0m
2022-04-08T18:39:27.1786056Z [90m at Nuke.Common.ControlFlow.SuppressErrorsIf(Boolean condition, Delegate action, Object defaultValue, Boolean includeStackTrace, Boolean logWarning)[0m
2022-04-08T18:39:27.2272867Z ?
2022-04-08T18:39:27.2274719Z [97;1m¦¦¦+ ¦¦+¦¦+ ¦¦+¦¦+ ¦¦+¦¦¦¦¦¦¦+[0m
2022-04-08T18:39:27.2275048Z [97;1m¦¦¦¦+ ¦¦¦¦¦¦ ¦¦¦¦¦¦ ¦¦++¦¦+----+[0m
2022-04-08T18:39:27.2275514Z [97;1m¦¦+¦¦+ ¦¦¦¦¦¦ ¦¦¦¦¦¦¦¦++ ¦¦¦¦¦+ [0m
2022-04-08T18:39:27.2275785Z [97;1m¦¦¦+¦¦+¦¦¦¦¦¦ ¦¦¦¦¦+-¦¦+ ¦¦+--+ [0m
2022-04-08T18:39:27.2276070Z [97;1m¦¦¦ +¦¦¦¦¦+¦¦¦¦¦¦++¦¦¦ ¦¦+¦¦¦¦¦¦¦+[0m
2022-04-08T18:39:27.2276350Z [97;1m+-+ +---+ +-----+ +-+ +-++------+[0m
2022-04-08T18:39:27.2276564Z ?
2022-04-08T18:39:27.2437288Z [36;1mNUKE Execution Engine version 6.0.1 (Windows,.NETCoreApp,Version=v5.0)[0m
2022-04-08T18:39:27.2438057Z ?
2022-04-08T18:39:27.7707082Z ##[warning]Could not complete checking build configurations within 500 milliseconds
2022-04-08T18:39:27.7732088Z [90m18:39:27[0m[90m [[0m[33;1mWRN[0m[90m] [0mCould not complete checking build configurations within [0m[36;1m500[0m milliseconds[0m
2022-04-08T18:39:31.8279552Z ##[group]Restore
2022-04-08T18:39:31.8446550Z ##[error]Target "Restore" failed
2022-04-08T18:39:31.8794936Z [90m18:39:31[0m[90m [[0m[31;1mERR[0m[90m] [0mTarget [0m[36;1mRestore[0m failed[0m
2022-04-08T18:39:31.8796042Z System.NullReferenceException: Object reference not set to an instance of an object.[0m
2022-04-08T18:39:31.8796591Z [90m at Nuke.Common.ProjectModel.Solution.op_Implicit(Solution solution)[0m
2022-04-08T18:39:31.8797101Z [90m at Build.<get_Restore>b__20_2(MSBuildSettings s) in D:\a\1\s\build\Build.cs:line 77[0m
2022-04-08T18:39:31.8797732Z [90m at Nuke.Common.Tools.MSBuild.MSBuildTasks.MSBuild(Configure`1 configurator)[0m
2022-04-08T18:39:31.8798459Z [90m at Build.<get_Restore>b__20_1() in D:\a\1\s\build\Build.cs:line 77[0m
2022-04-08T18:39:31.8798994Z [90m at Nuke.Common.Execution.BuildExecutor.<>c.<Execute>b__4_2(Action x)[0m
2022-04-08T18:39:31.8799610Z [90m at Nuke.Common.Utilities.Collections.EnumerableExtensions.ForEach[T](IEnumerable`1 enumerable, Action`1 action)[0m
2022-04-08T18:39:31.8800407Z [90m at Nuke.Common.Execution.BuildExecutor.Execute(NukeBuild build, ExecutableTarget target, IReadOnlyCollection`1 previouslyExecutedTargets, Boolean failureMode)[0m
2022-04-08T18:39:31.8817982Z ##[endgroup]Restore
2022-04-08T18:39:31.8863504Z ##[group]Warnings & Errors
2022-04-08T18:39:31.8882060Z [90m[[0m[33;1mWRN[0m[90m] [0m[90m[0m[90m: [0mException has been thrown by the target of an invocation.[0m
2022-04-08T18:39:31.8884458Z [90m[[0m[33;1mWRN[0m[90m] [0m[90m[0m[90m: [0mCould not complete checking build configurations within [0m[36;1m500[0m milliseconds[0m
2022-04-08T18:39:31.8888070Z [90m[[0m[31;1mERR[0m[90m] [0m[90mRestore[0m[90m: [0mTarget [0m[36;1mRestore[0m failed[0m
2022-04-08T18:39:31.8889294Z ##[endgroup]Warnings & Errors
2022-04-08T18:39:31.8932545Z ?
2022-04-08T18:39:31.8933184Z [97;1m---------------------------------------[0m
2022-04-08T18:39:31.8933694Z [36;1mTarget Status Duration[0m
2022-04-08T18:39:31.8935167Z [97;1m---------------------------------------[0m
2022-04-08T18:39:31.9029244Z [31;1mRestore Failed < 1sec // NullReferenceException: Object reference not set to an instance of an object.[0m
2022-04-08T18:39:31.9032700Z [33;1mPreBuild NotRun [0m
2022-04-08T18:39:31.9033326Z [33;1mBuildFrontend NotRun [0m
2022-04-08T18:39:31.9034546Z [33;1mCompile NotRun [0m
2022-04-08T18:39:31.9035764Z [33;1mPublish NotRun [0m
2022-04-08T18:39:31.9036389Z [33;1mPackage NotRun [0m
2022-04-08T18:39:31.9036847Z [97;1m---------------------------------------[0m
2022-04-08T18:39:31.9037329Z [36;1mTotal < 1sec[0m
2022-04-08T18:39:31.9037792Z [97;1m---------------------------------------[0m
2022-04-08T18:39:31.9038298Z ?
2022-04-08T18:39:31.9054882Z [31;1mBuild failed on 4/8/2022 6:39:31 PM. (?°?°)?? ???[0m
2022-04-08T18:39:32.1509226Z ##[error]Cmd.exe exited with code '-1'.
2022-04-08T18:39:32.2145341Z ##[section]Finishing: NUKE Build
but I definitely have a solution file at:
D:\a\1\s\src\MySolution.sln
I added a YAML task to 100% confirm it is there (and it's there):
- task: CmdLine#2
displayName: 'List Source Folder'
inputs:
script: 'tree $(Build.SourcesDirectory) /f'
Here is the listing:
2022-04-08T18:57:59.6501952Z ##[section]Starting: List Source Folder
2022-04-08T18:57:59.6793825Z ==============================================================================
2022-04-08T18:57:59.6794430Z Task : Command line
2022-04-08T18:57:59.6794753Z Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
2022-04-08T18:57:59.6795061Z Version : 2.201.1
2022-04-08T18:57:59.6795267Z Author : Microsoft Corporation
2022-04-08T18:57:59.6795600Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
2022-04-08T18:57:59.6795961Z ==============================================================================
2022-04-08T18:58:02.0506033Z Generating script.
2022-04-08T18:58:02.0739760Z Script contents: shell
2022-04-08T18:58:02.0756595Z tree D:\a\1\s /f
2022-04-08T18:58:02.1475179Z ========================== Starting Command Output ===========================
2022-04-08T18:58:02.1898242Z ##[command]"C:\Windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "D:\a\_temp\5da783bd-9a97-4da8-8bef-3d739b2a3128.cmd""
2022-04-08T18:58:02.2402115Z Folder PATH listing for volume Temp
2022-04-08T18:58:02.2403508Z Volume serial number is 00000247 52D3:EF1F
2022-04-08T18:58:02.2404144Z D:\A\1\S
2022-04-08T18:58:02.2405018Z | .gitignore
2022-04-08T18:58:02.2405560Z | azure-pipelines.yml
2022-04-08T18:58:02.2406147Z | clean.bat
2022-04-08T18:58:02.2406717Z | nuget.config
2022-04-08T18:58:02.2407288Z | README.md
2022-04-08T18:58:02.2407842Z |
2022-04-08T18:58:02.2408341Z +---.nuke
2022-04-08T18:58:02.2409000Z | build.schema.json
2022-04-08T18:58:02.2409391Z | parameters.json
2022-04-08T18:58:02.2409867Z |
2022-04-08T18:58:02.2410372Z +---build
2022-04-08T18:58:02.2410926Z | .editorconfig
2022-04-08T18:58:02.2411502Z | Build.cs
2022-04-08T18:58:02.2412097Z | Configuration.cs
2022-04-08T18:58:02.2412876Z | Directory.Build.props
2022-04-08T18:58:02.2413461Z | Directory.Build.targets
2022-04-08T18:58:02.2414211Z | _build.csproj
2022-04-08T18:58:02.2414923Z | _build.csproj.DotSettings
2022-04-08T18:58:02.2415470Z |
2022-04-08T18:58:02.2535989Z +---src
2022-04-08T18:58:02.2536325Z | build.cmd
2022-04-08T18:58:02.2536699Z | build.ps1
2022-04-08T18:58:02.2536957Z | build.sh
2022-04-08T18:58:02.2537193Z | MySolution.sln
2022-04-08T18:58:02.2537398Z |
.
.
.
Lot's of project folders/files here (removed for brevity)
.
.
.
2022-04-08T18:58:02.3340758Z
2022-04-08T18:58:02.3743539Z ##[section]Finishing: List Source Folder
I'm at a loss (why doesn't it find it?), anyone have any insight on why this might be happening?

Turns out... what I thought, was NUKE searching for a solution file, was actually not the case at all.
The error:
Expected file to exist: D:\a\1\s\**\*.sln
was due to the existence of a variable that is normally added to the standard YAML pipeline file (for use with NuGet/MSBuild tasks), i.e.
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
- task: NuGetCommand#2
displayName: 'Restore'
inputs:
command: 'restore'
restoreSolution: '$(solution)'
feedsToUse: 'config'
nugetConfigPath: './nuget.config'
- task: VSBuild#1
displayName: 'Build'
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
That solution: '**/*.sln' was somehow overriding the solution value configured in the parameters.json file. Not 100% sure why... but once that environment variable was removed NUKE began to work as expected.

.nuke marks the root directory, so your solution file is located under ./src/MySolution.sln from there and should also be noted like that in the parameters.json

Related

Luigi does not send error codes to concourse ci

I have a test pipeline on concourse with one job that runs a set of luigi tasks. My problem is: failures in the luigi tasks do not rise up to the concourse job. In other words, if a luigi task fails, concourse will not register that failure and states that the concourse job completed successfully. I will first post the code I am running, then the solutions I have tried.
luigi-tasks.py
class Pipeline1(luigi.WrapperTask):
def requires(self):
yield Task1()
yield Task2()
yield Task3()
tasks.py
class Task1(luigi.Task):
def requires(self):
return None
def output(self):
return luigi.LocalTarget('stuff/task1.csv')
def run(self):
#uncomment line below to generate task failure
#assert(True==False)
print('task 1 complete...')
t = pd.DataFrame()
with self.output().open('w') as outtie:
outtie.write('complete')
# Tasks 2 and 3 are duplicates of this, but with 1s replaced with 2s or 3s.
config file
[retcode]
# codes are in increasing level of severity (for most applications)
already_running=10
missing_data=20
not_run=25
task_failed=30
scheduling_error=35
unhandled_exception=40
begin.sh
#!/bin/sh
set -e
export PYTHONPATH='.'
luigi --module luigi-tasks Pipeline1 --local-scheduler
echo $?
pipeline.yml
# <resources, resource types, and docker image build job defined here>
#job of interest
- name: run-docker-image
plan:
- get: timer
trigger: true
- get: docker-image-ecr
passed: [build-docker-image]
- get: run-git
- task: run-script
image: docker-image-ecr
config:
inputs:
- name: run-git
platform: linux
run:
dir: ./run-git
path: /bin/bash
args: ["begin.sh"]
I've introduced errors in a few ways: assertions/raising an exception (ValueError) within an individual task's run() method and within the wrapper, and sys.exit(luigi.retcodes.retcode().unhandled_exception). I also tried failing all tasks. I did this in case the error needed to be generated in a specific manner/location. Though they all produced a failed task, none of them produced an error in the concourse server.
At first, I thought concourse just gives a success if it can run the file or command tasked to it. I'm not sure it's that simple, though. Interestingly, when I run the pipeline on my local computer (luigi --modules luigi-tasks Pipeline1 --local-scheduler) I get an appropriate return code (e.g. 30), but when I run the pipeline within the concourse server, I get a return code of 0 after the luigi tasks complete (from echo $? in the bash script).
Would appreciate any insight into this problem.
My suspicion is that luigi doesn't see your config file with return codes. Its default behavior is to return 0, whether tasks fail or succeed.
This experiment should help to debug that:
Force a failed job: add an exit 1 at the end of begin.sh
Hijack the job: fly -t <target> i -j <pipeline>/<job> -> select run-script
cd ./run-git; /bin/bash begin.sh
Ensure the luigi config is present and named appropriately, e.g. luigi.cfg
Re-run the command: LUIGI_CONFIG_PATH=luigi.cfg bash ./begin.sh
Check output: echo $?

Running java utility via command in azure pipelines does not pass parameters

I have created an utility (java jar-file) to generate a file upon the building process. And placed it into /tools folder in my source code root folder.
In azure-pipelines I am using this approach to run this jar-file upon building the project (Xamarin project).
- task: CmdLine#2
inputs:
script: "java -jar $(build.SourcesDirectory)/tools/version2image.jar $(fullVersionText) $(androidVersionFileLocation)"
The task launched ok, but in the logs I get the following:
2020-08-17T14:48:45.4688112Z java -jar D:\a\1\s/tools/version2image.jar 1.0.0.123 'D:\a\1\s/XamarinProject/XamarinProject.Android/Resources/drawable/version.png'
2020-08-17T14:48:45.5231861Z ========================== Starting Command Output ===========================
2020-08-17T14:48:45.5731945Z ##[command]"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "D:\a\_temp\d5706f7c-43cd-4d50-8f17-98a6ae0a3391.cmd""
2020-08-17T14:48:46.8000947Z Version 2 Image Utility. version 1.0
2020-08-17T14:48:46.8001744Z
2020-08-17T14:48:46.8002367Z
2020-08-17T14:48:46.8003059Z Usage:
2020-08-17T14:48:46.8004115Z
2020-08-17T14:48:46.8004468Z java -jar version2image.jar version_string output_file_location
2020-08-17T14:48:46.8004769Z
2020-08-17T14:48:46.8005096Z Example:
2020-08-17T14:48:46.8005464Z
2020-08-17T14:48:46.8005739Z java -jar version2image.jar 1.0.0.121 c:/myproject/images/version.png
2020-08-17T14:48:46.8005961Z
2020-08-17T14:48:46.8507661Z ##[section]Finishing: CmdLine
In other words Azure does not pass parameters properly to the jar file. My application thinks that it launched without parameters.
But when I run this utility locally on my computer it works ok.
If it helps, in the java utility I get command line parameters like that:
final int correctParamsCount = 2;
if (args.length != correctParamsCount) {
System.out.println("Usage:\n\njava -jar version2image.jar <version_string> <output_file_location>\n");
System.out.println("Example:\n\njava -jar version2image.jar 1.0.0.121 c:/myproject/images/version.png\n");
System.exit(0);
}
final String versionNumber = args[0];
final String outputFilePath = args[1];
How can I fix this issue?
To resolve this issue (thanks to #riQQ) I should update AndroidVersionFileLocation variable, and remove single quote symbols from the path.
And add double quotes to the utility command call:
It should look like this:
script: 'java -jar $(build.SourcesDirectory)/tools/version2image.jar "$(fullVersionText)" "$(androidVersionFileLocation)"'
instead of this:
script: "java -jar $(build.SourcesDirectory)/tools/version2image.jar $(fullVersionText) $(androidVersionFileLocation)"

Variable substitution in config, JSON files in Azure DevOps Pipeline

I am a bit new in Azure DevOps. I know there is way that we can do XML transformation and JSON variable replacement. We can define key, value and json variable in library and that would update in release pipeline. Is there any way like just replacing a variable value in any file (config, json). for example I define a library value (hello = world), and Release pipeline task would find and replace $hello in config, json file and replace it with "world".
I am trying to use replace tokens as below.
Yes I was looking at same. Looks like its not replacing the values. Do you see any configuration issue as below
steps:
- task: qetza.replacetokens.replacetokens-task.replacetokens#3
displayName: 'Replace tokens in **/*.config **/*.json'
inputs:
targetFiles: |
**/*.config
**/*.json
verbosity: detailed
tokenPrefix: '{'
tokenSuffix: '}'
log as below
2020-05-11T18:44:01.6149125Z ##[section]Starting: Replace tokens in **/*.config **/*.json
2020-05-11T18:44:01.6363261Z ==============================================================================
2020-05-11T18:44:01.6363986Z Task : Replace Tokens
2020-05-11T18:44:01.6364452Z Description : Replace tokens in files
2020-05-11T18:44:01.6364873Z Version : 3.6.0
2020-05-11T18:44:01.6365252Z Author : Guillaume Rouchon
2020-05-11T18:44:01.6365919Z Help : v3.6.0 - [More Information](https://github.com/qetza/vsts-replacetokens-task#readme)
2020-05-11T18:44:01.6366694Z ==============================================================================
2020-05-11T18:44:02.2020864Z pattern: \{\s*((?:(?!\{)(?!\s*\}).)*)\s*\}
2020-05-11T18:44:02.2247835Z replaced 0 tokens out of 0 in 0 file(s) in 0.04 seconds.
2020-05-11T18:44:03.1202699Z ##[section]Finishing: Replace tokens in **/*.config **/*.json
Library value
myhello = Hello
Value in appsettngs.config
<section name="{myhello}" type="Exceptionless.ExceptionlessSection, Exceptionless" />
Yes. You can use token replace task. Please check this extension
I used your configuration (I just changed target folder to find a place wher I keep files) with this file.
steps:
- task: replacetokens#3
displayName: 'Replace tokens in *.config *.json'
inputs:
targetFiles: |
stackoverflow/23-token-replace/*.config
stackoverflow/23-token-replace/*.json
verbosity: detailed
tokenPrefix: '{'
tokenSuffix: '}'
config file:
<configuration>
<configSections>
<section name="sampleSection"
type="System.Configuration.SingleTagSectionHandler" />
<section name="{myhello}" type="Exceptionless.ExceptionlessSection, Exceptionless" />
</configSections>
<sampleSection setting1="Value1"
setting2="value two"
setting3="third value" />
</configuration>
And all went fine. Here you have a log for a build.
replacing tokens in: /home/vsts/work/1/s/stackoverflow/23-token-replace/appsettings.config
using encoding: ascii
myhello: Hello
1 tokens replaced out of 1
replaced 1 tokens out of 1 in 1 file(s) in 0.033 seconds.
All looks fine. Are you sure you have a correct targetFiles? **/*.config means that extension will look for any-folder-name/any-file-name.config located in your root folder.
The error replaced 0 tokens out of 0 in 0 file(s) in 0.04 seconds indicates the config or json files were not found in the default working directory.
Below are the possible reasons that the config/json files not found in the default working directory.
1, Your artifacts published from build pipeline is zipped. If the config/json files reside in the zipped artifacts, they cannot be found by the replacetoken task.
So you need to check if the artifacts downloaded in release pipeline is a zip file. If it is zipped, you need to add the Extract files task to unzip it before replacetoken task.
You can easily check the artifacts by clicking the 3dots highlighted in below screenshot.
2, If the config/json files are not in the default working directory. You need to specify in Root directory field the path to the folder where the config/json files reside.
Hope above helps!

Publish files with UniversalPackages#0 - "The path provided is invalid."

I'm trying to publish a file (Helloworld.txt) to my Universal Packages directory to pass on to a different stage within my Release Piepline (using UniversalPackages#0).
I cannot for the life of me figure out how to make it work.
I'm trying to follow this KB but it leaves me confused:
https://learn.microsoft.com/en-us/azure/devops/pipelines/artifacts/universal-packages?view=azure-devops&tabs=yaml
For example, I can't determine what vstsFeedPublish is and don't know if vstsFeedPackagePublish can be a new name I make up on the spot or if it is actually the name of an existing file/folder.
What "path" am I entering incorrectly that's making it fail?
Stage Deployment Steps:
Helloworld Output to TXT:
cd $(Build.ArtifactStagingDirectory)
"$(System.DefaultWorkingDirectory)/Helloworld Build/Helloworld EXE Folder/Helloworld.exe" >> WriteLineOutput.txt
I cd into $(Build.ArtifactStagingDirectory) first because that is the default folder UniversalPackages#0 looks to publish files, so I want WriteLineOutput.txt to be generated there.
Publish Output TXT to Universal Dir (YAML):
steps:
- task: UniversalPackages#0
displayName: 'Publish Output TXT to Universal Dir'
inputs:
command: publish
vstsFeed: '0a3a9abd-83fd-495f-967b-e986c523f2d2'
vstsPackageVersion: 1
vstsFeedPublish: '0a3a9abd-83fd-495f-967b-e986c523f2d2'
vstsFeedPackagePublish: 'writelineoutput-txt'
versionOption: minor
packagePublishDescription: 'TXT output from Helloworld.exe'
Working Directory Structure:
"Publish Output TXT to Universal Dir" Task Output:
2019-12-02T03:35:35.2264352Z ##[section]Starting: Publish Output TXT to Universal Dir
2019-12-02T03:35:35.2381247Z ==============================================================================
2019-12-02T03:35:35.2381328Z Task : Universal packages
2019-12-02T03:35:35.2381359Z Description : Download or publish Universal Packages
2019-12-02T03:35:35.2381412Z Version : 0.160.1
2019-12-02T03:35:35.2381461Z Author : Microsoft Corporation
2019-12-02T03:35:35.2381490Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks
2019-12-02T03:35:35.2381520Z ==============================================================================
2019-12-02T03:35:36.0651445Z SYSTEMVSSCONNECTION exists true
2019-12-02T03:35:36.6058302Z Downloading: https://0t3vsblobprodcus362.vsblob.vsassets.io/artifacttool/artifacttool-win10-x64-Release_0.2.128.zip?sv=2017-04-17&sr=b&sig=tHZQU3V2DuXcC0Y1xnmzB7Zw7kMdjJSijWVDiztc9UE%3D&spr=https&se=2019-12-02T04%3A35%3A37Z&sp=r&P1=1575261037&P2=11&P3=2&P4=LS6Ffab5P%2bb8Q9r3aGsGLlK9ELRD6bRxxlTkDc5aEc8%3d
2019-12-02T03:35:39.3862184Z Caching tool: ArtifactTool 0.2.128 x64
2019-12-02T03:35:40.4414172Z SYSTEMVSSCONNECTION exists true
2019-12-02T03:35:41.4415128Z Publishing package: writelineoutput-txt, version: 0.1.0 using feed id: 65dc653c-5c3b-771c-b308-34b199d8fcee, project: null
2019-12-02T03:35:41.4469092Z [command]C:\hostedtoolcache\windows\ArtifactTool\0.2.128\x64\ArtifactTool.exe universal publish --feed 65dc653c-5c3b-771c-b308-34b199d8fcee --service https://vsrm.dev.azure.com/sawtooth-capstone/ --package-name writelineoutput-txt --package-version 0.1.0 --path D:\a\r1\a\$(Build.ArtifactStagingDirectory) --patvar UNIVERSAL_PUBLISH_PAT --verbosity None --description "TXT output from Helloworld.exe"
2019-12-02T03:35:44.0492154Z {"#t":"2019-12-02T03:35:43.3152933Z","#m":"ApplicationInsightsTelemetrySender will correlate events with X-TFS-Session 23e076ea-5122-4c06-b92a-2aef5974defd","#i":"8778ba0f","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.315Z"}
2019-12-02T03:35:44.0493421Z {"#t":"2019-12-02T03:35:43.7170274Z","#m":"Ensuring that the package does not yet exist...","#i":"40e01e14","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.717Z"}
2019-12-02T03:35:44.0494251Z {"#t":"2019-12-02T03:35:43.8900269Z","#m":"Package does not yet exist","#i":"c781eca5","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.890Z"}
2019-12-02T03:35:44.0494769Z {"#t":"2019-12-02T03:35:43.8913512Z","#m":"Pushing content...","#i":"3aa40378","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.891Z"}
2019-12-02T03:35:44.0495859Z {"#t":"2019-12-02T03:35:43.9060246Z","#m":"DedupManifestArtifactClient will correlate http requests with X-TFS-Session 23e076ea-5122-4c06-b92a-2aef5974defd","#i":"09a6f3ce","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.906Z"}
2019-12-02T03:35:44.0496478Z {"#t":"2019-12-02T03:35:44.0301714Z","#m":"The path provided is invalid.","#i":"05178f7d","#l":"Error","SourceContext":"ArtifactTool.Program","UtcTimestamp":"2019-12-02 03:35:44.030Z"}
2019-12-02T03:35:44.0776082Z ##[error]Error: An unexpected error occurred while trying to push the package. Exit code(16) and error({"#t":"2019-12-02T03:35:43.3152933Z","#m":"ApplicationInsightsTelemetrySender will correlate events with X-TFS-Session 23e076ea-5122-4c06-b92a-2aef5974defd","#i":"8778ba0f","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.315Z"}
{"#t":"2019-12-02T03:35:43.7170274Z","#m":"Ensuring that the package does not yet exist...","#i":"40e01e14","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.717Z"}
{"#t":"2019-12-02T03:35:43.8900269Z","#m":"Package does not yet exist","#i":"c781eca5","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.890Z"}
{"#t":"2019-12-02T03:35:43.8913512Z","#m":"Pushing content...","#i":"3aa40378","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.891Z"}
{"#t":"2019-12-02T03:35:43.9060246Z","#m":"DedupManifestArtifactClient will correlate http requests with X-TFS-Session 23e076ea-5122-4c06-b92a-2aef5974defd","#i":"09a6f3ce","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.906Z"}
{"#t":"2019-12-02T03:35:44.0301714Z","#m":"The path provided is invalid.","#i":"05178f7d","#l":"Error","SourceContext":"ArtifactTool.Program","UtcTimestamp":"2019-12-02 03:35:44.030Z"})
2019-12-02T03:35:44.0789627Z ##[error]Packages failed to publish
2019-12-02T03:35:44.0898947Z ##[section]Finishing: Publish Output TXT to Universal Dir
Key Lines:
2019-12-02T03:35:44.0496478Z {"#t":"2019-12-02T03:35:44.0301714Z","#m":"The path provided is invalid.","#i":"05178f7d","#l":"Error","SourceContext":"ArtifactTool.Program","UtcTimestamp":"2019-12-02 03:35:44.030Z"}
2019-12-02T03:35:44.0776082Z ##[error]Error: An unexpected error occurred while trying to push the package. Exit code(16) and error({"#t":"2019-12-02T03:35:43.3152933Z","#m":"ApplicationInsightsTelemetrySender will correlate events with X-TFS-Session 23e076ea-5122-4c06-b92a-2aef5974defd","#i":"8778ba0f","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.315Z"}
EDIT:
Well, I read it's best practice to use the Build pipeline to publish artifacts and the Release pipeline to run/test them, so I decided to just publish the artifact from the Build pipeline instead of trying to make the same Helloworld.txt again during the Release pipeline. But I'm willing to take the inevitable downvotes if someone can help me figure out how to publish new files created in the Release pipeline into the Universal packages directory.
I'd better suggest you call exe to generate the txt file in Build. Then publish them as artifacts to release pipeline. Then you can easily pick the HelloWord.txt file in Release pipeline.
This task can be used both in Build and Release pipeline. The difference between apply this task in Build and release just be the Path to file(s) to publish value which you very confused.
For Release pipeline:
If what you want is publish the HelloWord.txt into package, just click , and then select the corresponding file HelloWord.txt from it.
So, what its value should be $(System.DefaultWorkingDirectory)/{Source alias}/{artifact name}/s/HelloWorld.txt.
Note: This way is applied when you put the txt generated in Build pipeline, and then publish them as artifact and used in release pipeline.
Similar in Build pipeline, you can also select the file from that button. For its YAML format, just input the file name like:
inputs:
command: publish
publishDirectory: 'azure-pipelines.txt'
vstsFeedPublish: '*****'
vstsFeedPackagePublish: merlin
versionOption: custom
versionPublish: 0.0.1
packagePublishDescription: published in 2019/12/2
If azure-pipelines.txt file is under a folder, just input it as a {folder name}/azure-pipelines.txt.
In your issue, if you want to put the file generate and the package publish both in Build pipeline. Since I do not very clear know how's your HellowWorld.exe script like. The location of HelloWorld.txt is decided by your script. If you did not define the generated file location in script, as default, this txt file path should same with exe. According to the pic you shared, seem its path is HelloWorld EXE Folder/HelloWorld.txt. I suggest you can use private agent firstly to run this Build to confirm its(.txt) path.
vstsFeedPublish should be the existing feed you have created in your project. Here it can not be the new name that dose not exist before the pipeline executed.
vstsFeedPackagePublish is the package name you want it stored in feed. For me as sample, here I name it as merlin. After the release finished:
You can specify a new name or use the exists one. Use a new name means create a new package in Feed, and use the exists one just means the version incremental.

How do I use NUnit in VSTS?

I am trying to use NUnit 3 within Visual Studio Team System which they seem to have made really hard. I have added in a test assemblies step to the build process and in Advanced execution options -> Path to Custom Test Adapters, I have put in the directory path to NUnitVisualStudioTestAdapter-2.0.0.vsix plugin as advised in the help.
No matter what I do it doesn't seem to find or attempt to run this. It just runs Visual Studio Test and reports that no tests were found. I have also tried putting the test adapter in as a NuGet package and the path to the tools in that, but that doesn't work either.
Has anyone managed to get NUnit working in VSTS and reporting back test results?
The log I get is:
2017-02-07T10:59:26.2778725Z ##[section]Starting: Test Assemblies **\*.Unit.Tests.dll;-:**\obj\**
2017-02-07T10:59:26.2798723Z ==============================================================================
2017-02-07T10:59:26.2798723Z Task : Visual Studio Test
2017-02-07T10:59:26.2798723Z Description : Run tests with Visual Studio test runner
2017-02-07T10:59:26.2798723Z Version : 2.0.10
2017-02-07T10:59:26.2798723Z Author : Microsoft Corporation
2017-02-07T10:59:26.2798723Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkId=835764)
2017-02-07T10:59:26.2798723Z ==============================================================================
2017-02-07T10:59:28.6268742Z ##[warning]No test assemblies found matching the pattern: **\*.Unit.Tests.dll;-:**\obj\**.
2017-02-07T10:59:28.6998724Z ##[section]Finishing: Test Assemblies **\*.Unit.Tests.dll;-:**\obj\**
The unit test DLL file is called App.Web.Unit.Tests.dll.
With system.debug = true set, the log I get is as follows (with some import statements stripped out to fit in 30,000 characters):
2017-02-08T10:44:46.2171630Z ##[section]Starting: Test Assemblies **\*.Unit.Tests.dll;-:**\obj\**
2017-02-08T10:44:46.2251636Z ==============================================================================
2017-02-08T10:44:46.2251636Z Task : Visual Studio Test
2017-02-08T10:44:46.2251636Z Description : Run tests with Visual Studio test runner
2017-02-08T10:44:46.2251636Z Version : 1.0.84
2017-02-08T10:44:46.2251636Z Author : Microsoft Corporation
2017-02-08T10:44:46.2251636Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkId=624539)
2017-02-08T10:44:46.2251636Z ==============================================================================
2017-02-08T10:44:46.2381636Z Preparing task execution handler.
2017-02-08T10:44:52.1286673Z Executing the powershell script: D:\a\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\1.0.84\VSTest.ps1
2017-02-08T10:44:52.1296976Z ##[debug]PowerShellHandler.Execute - AddCommand(D:\a\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\1.0.84\VSTest.ps1)
2017-02-08T10:44:52.1296976Z ##[debug]PowerShellHandler.Execute - Add inputParameters
2017-02-08T10:44:52.1296976Z ##[debug]PowerShellHandler.Execute - AddParameter(testAssembly=**\*Tests.dll;-:**\obj\**)
2017-02-08T10:44:52.1296976Z ##[debug]PowerShellHandler.Execute - AddParameter(testFiltercriteria=)
2017-02-08T10:44:52.1296976Z ##[debug]PowerShellHandler.Execute - AddParameter(runSettingsFile=D:\a\1\s)
2017-02-08T10:44:52.1296976Z ##[debug]PowerShellHandler.Execute - AddParameter(overrideTestrunParameters=)
2017-02-08T10:44:52.1296976Z ##[debug]PowerShellHandler.Execute - AddParameter(codeCoverageEnabled=true)
2017-02-08T10:44:52.1296976Z ##[debug]PowerShellHandler.Execute - AddParameter(runInParallel=false)
2017-02-08T10:44:52.1296976Z ##[debug]PowerShellHandler.Execute - AddParameter(vstestLocationMethod=version)
2017-02-08T10:44:52.1296976Z ##[debug]PowerShellHandler.Execute - AddParameter(vsTestVersion=latest)
2017-02-08T10:44:52.1296976Z ##[debug]PowerShellHandler.Execute - AddParameter(vstestLocation=)
2017-02-08T10:44:52.1296976Z ##[debug]PowerShellHandler.Execute - AddParameter(pathtoCustomTestAdapters=D:\a\1\s\packages)
2017-02-08T10:44:52.1296976Z ##[debug]PowerShellHandler.Execute - AddParameter(otherConsoleOptions=)
2017-02-08T10:44:52.1296976Z ##[debug]PowerShellHandler.Execute - AddParameter(testRunTitle=)
2017-02-08T10:44:52.1296976Z ##[debug]PowerShellHandler.Execute - AddParameter(platform=any cpu)
2017-02-08T10:44:52.1296976Z ##[debug]PowerShellHandler.Execute - AddParameter(configuration=release)
2017-02-08T10:44:52.1296976Z ##[debug]PowerShellHandler.Execute - AddParameter(publishRunAttachments=true)
2017-02-08T10:44:52.4586977Z ##[debug]PowerShellHandler.Execute - Invoke
2017-02-08T10:44:52.5076979Z ##[debug]Entering script VSTest.ps1
2017-02-08T10:44:52.5096982Z ##[debug]vsTestVersion = latest
2017-02-08T10:44:52.5096982Z ##[debug]testAssembly = **\*Tests.dll;-:**\obj\**
2017-02-08T10:44:52.5096982Z ##[debug]testFiltercriteria =
2017-02-08T10:44:52.5096982Z ##[debug]runSettingsFile = D:\a\1\s
2017-02-08T10:44:52.5096982Z ##[debug]codeCoverageEnabled = true
2017-02-08T10:44:52.5106990Z ##[debug]pathtoCustomTestAdapters = D:\a\1\s\packages
2017-02-08T10:44:52.5106990Z ##[debug]overrideTestrunParameters =
2017-02-08T10:44:52.5106990Z ##[debug]otherConsoleOptions =
2017-02-08T10:44:52.5106990Z ##[debug]testRunTitle =
2017-02-08T10:44:52.5106990Z ##[debug]platform = any cpu
2017-02-08T10:44:52.5106990Z ##[debug]configuration = release
2017-02-08T10:44:52.5106990Z ##[debug]publishRunAttachments = true
2017-02-08T10:44:52.5106990Z ##[debug]vstestLocation =
2017-02-08T10:44:52.5476990Z ##[debug]Loading module from path 'C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\2.111.1\externals\vstshost\Microsoft.TeamFoundation.DistributedTask.Task.Internal\Microsoft.TeamFoundation.DistributedTask.Task.Internal.psd1'.
2017-02-08T10:44:52.5566992Z ##[debug]Loading module from path 'C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\2.111.1\externals\vstshost\Microsoft.TeamFoundation.DistributedTask.Task.Internal\Microsoft.TeamFoundation.DistributedTask.Task.Internal.psm1'.
2017-02-08T10:44:52.5656993Z ##[debug]Loading module from path 'C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\2.111.1\externals\vstshost\Microsoft.TeamFoundation.DistributedTask.Task.LegacySDK.dll'.
2017-02-08T10:44:52.6656999Z ##[debug]Loading module from path 'C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\2.111.1\externals\vstshost\Microsoft.TeamFoundation.DistributedTask.Task.Common\Microsoft.TeamFoundation.DistributedTask.Task.Common.psd1'.
2017-02-08T10:44:52.6727018Z ##[debug]Loading module from path 'C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\2.111.1\externals\vstshost\Microsoft.TeamFoundation.DistributedTask.Task.Common\Microsoft.TeamFoundation.DistributedTask.Task.Common.psm1'.
2017-02-08T10:44:52.7086999Z ##[debug]Loading module from path 'C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\2.111.1\externals\vstshost\Microsoft.TeamFoundation.DistributedTask.Task.TestResults\Microsoft.TeamFoundation.DistributedTask.Task.TestResults.psm1'.
2017-02-08T10:44:52.7336993Z ##[debug]Loading module from path 'C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\2.111.1\externals\vstshost\Microsoft.TeamFoundation.DistributedTask.Task.CodeCoverage\Microsoft.TeamFoundation.DistributedTask.Task.CodeCoverage.psm1'.
2017-02-08T10:44:52.7406994Z ##[debug]Importing cmdlet 'Invoke-ResultPublisher'.
2017-02-08T10:44:52.7416986Z ##[debug]Importing cmdlet 'Publish-TestResults'.
2017-02-08T10:44:52.7416986Z ##[debug]Importing cmdlet 'Add-BuildArtifactLink'.
2017-02-08T10:44:52.7416986Z ##[debug]Importing cmdlet 'Get-MSBuildLocation'.
2017-02-08T10:44:52.7416986Z ##[debug]Importing cmdlet 'Get-ToolPath'.
2017-02-08T10:44:52.7416986Z ##[debug]Importing cmdlet 'Get-VisualStudioPath'.
2017-02-08T10:44:52.7427007Z ##[debug]Importing cmdlet 'Get-VssConnection'.
2017-02-08T10:44:52.7427007Z ##[debug]Importing cmdlet 'Invoke-Ant'.
2017-02-08T10:44:52.7427007Z ##[debug]Importing cmdlet 'Register-XamarinLicense'.
2017-02-08T10:44:52.7427007Z ##[debug]Importing cmdlet 'Remove-Environment'.
2017-02-08T10:44:52.7427007Z ##[debug]Importing cmdlet 'Remove-EnvironmentResources'.
2017-02-08T10:44:52.7427007Z ##[debug]Importing cmdlet 'Complete-EnvironmentOperation'.
2017-02-08T10:44:52.7427007Z ##[debug]Importing cmdlet 'Complete-EnvironmentResourceOperation'.
2017-02-08T10:44:52.7436999Z ##[debug]Importing cmdlet 'Complete-ResourceOperation'.
2017-02-08T10:44:52.7436999Z ##[debug]Importing cmdlet 'Get-Environment'.
2017-02-08T10:44:52.7436999Z ##[debug]Importing cmdlet 'Get-EnvironmentProperty'.
2017-02-08T10:44:52.7436999Z ##[debug]Importing cmdlet 'Get-EnvironmentResources'.
2017-02-08T10:44:52.7436999Z ##[debug]Importing cmdlet 'Get-ExternalIpAddress'.
2017-02-08T10:44:52.7436999Z ##[debug]Importing cmdlet 'Get-ParsedSessionVariables'.
2017-02-08T10:44:52.7436999Z ##[debug]Importing cmdlet 'Add-TaskIssue'.
2017-02-08T10:44:52.7447001Z ##[debug]Importing cmdlet 'Publish-CodeCoverage'.
2017-02-08T10:44:52.7447001Z ##[debug]Exporting cmdlet 'Enable-CodeCoverage'.
2017-02-08T10:44:52.7447001Z ##[debug]Exporting cmdlet 'Publish-CodeCoverage'.
2017-02-08T10:44:52.7447001Z ##[debug]Importing cmdlet 'Enable-CodeCoverage'.
2017-02-08T10:44:52.7447001Z ##[debug]Importing cmdlet 'Publish-CodeCoverage'.
2017-02-08T10:44:52.8017010Z ##[debug]Invoke - Get-TaskVariable cmdlet
2017-02-08T10:44:52.8107020Z ##[debug]Pattern found in solution parameter. Calling Find-Files.
2017-02-08T10:44:52.8107020Z ##[debug]Calling Find-Files with pattern: **\*Tests.dll;-:**\obj\**
2017-02-08T10:44:52.8147008Z ##[debug]FindFiles.FindMatchingFiles(rootFolder = D:\a\1\s, matchPattern = **\*Tests.dll;-:**\obj\**, includeFiles = True, includeFolders = False
2017-02-08T10:44:52.8177007Z ##[debug]FindFiles.GetMatchingItems(includePatterns.Count = 1, excludePatterns.Count = 1, includeFiles = True, includeFolders = False
2017-02-08T10:44:53.4177077Z ##[debug]FindFiles.FindMatchingFiles - Found 0 matches
2017-02-08T10:44:53.4237058Z ##[debug]Found files:
2017-02-08T10:44:53.4467065Z ##[debug]Processed: ##vso[task.logissue type=warning;code=002004;]
2017-02-08T10:44:53.4467065Z
2017-02-08T10:44:53.4467065Z
2017-02-08T10:44:53.4587060Z ##[warning]No test assemblies found matching the pattern: '**\*Tests.dll;-:**\obj\**'.
2017-02-08T10:44:53.4587060Z ##[debug]Processed: ##vso[task.logissue type=warning]No test assemblies found matching the pattern: '**\*Tests.dll;-:**\obj\**'.
2017-02-08T10:44:53.4607060Z ##[debug]Leaving script VSTest.ps1
2017-02-08T10:44:53.4914646Z ##[section]Finishing: Test Assemblies **\*.Unit.Tests.dll;-:**\obj\**
UPDATE:
I have installed the NUnit3TestAdapter package to the unit test project. I have amended the build step in VSTS:
It is version 2.*(preview)
The search pattern is:
*test*.dll
!\obj**
and in Advanced execution options I have Path to Custom Test Adapters set to $(Build.SourcesDirectory)\
I then get this debug information so at least it has found the test adapters if not the tests now:
[command]"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" D:\a\1\s\packages\NUnit3TestAdapter.3.7.0\tools\NUnit3.TestAdapter.dll /EnableCodeCoverage /logger:trx "/TestAdapterPath:\"D:\a\1\s\\\""
Microsoft (R) Test Execution Command Line Tool Version 14.0.25420.1
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
Warning: Using Isolation mode to run tests as required by effective Platform:X86 and .Net Framework:Framework35 settings for test run. Use the /inIsolation parameter to suppress this warning.
Information: NUnit Adapter 3.7.0.0: Test execution started
Information: Running all tests in D:\a\1\s\packages\NUnit3TestAdapter.3.7.0\tools\NUnit3.TestAdapter.dll
Information: NUnit failed to load D:\a\1\s\packages\NUnit3TestAdapter.3.7.0\tools\NUnit3.TestAdapter.dll
Information: NUnit Adapter 3.7.0.0: Test execution complete
Warning: No test is available in D:\a\1\s\packages\NUnit3TestAdapter.3.7.0\tools\NUnit3.TestAdapter.dll. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again.
The path to custom test adapters must point to the extracted vsix or the extracted NuGet package.
The easiest way to make this work is to add the NUnit Test Adapter NuGet package 2.x/3.x to your unit test project. The VsTest task should automatically detect test runners that are restored to the NuGet packages directory:
Make sure the nunit.framework version and the NUnit adapters versions match. Make sure that both packages are added to your test projects.
The issue in your original post is that the Visual Studio Test task cannot find the test assembly (App.Web.Unit.Tests.dll) you'd like to test. And in your update, after you change the search pattern to "*test.dll", it still cannot find the test assembly. It just find the "NUnit3.TestAdapter.dll" which is the binary file for NUnit test adapter and the binary file does not contains any test method. So you need to check the build log to see if the test assembly is generated correctly in build step and what's the path to it and then set the search pattern according to the path.
Update:
According to the logs you provided, the output files are placed in "D:\a\1\a" folder since you specified argument "/p:OutDir=D:\a\1\a". Try changing the search pattern to:
D:\a\1\a\*.Unit.Tests.dll or $(build.stagingDirectory)\*.Unit.Tests.dll