msbuild /t:metrics fails on azuredevops pipeline - azure-devops

While running below command for the solution it works fine on command line on on-premise.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" test.sln /t:Metrics -p:Configuration=Debug -p:Platform="Any CPU"
The task used in the pipeline is :
- task: CmdLine#2
inputs:
script: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" Test.sln /p:AzureDevOps=true /verbosity:d /t:Metrics -p:Configuration=Debug -p:Platform="Any CPU"'
workingDirectory: 'C:\a\1\s\Ett\Test'
failOnStderr: true
Also tried the task :
- task: VSBuild#1
displayName: CodeMetrics
inputs:
solution: '**\CN.Test.sln'
msbuildArgs: '/t:Metrics'
platform: 'Any CPU'
configuration: 'debug'
createLogFile: true
logFileVerbosity: 'detailed'
However fails to run from the pipeline with below error :
The target "Metrics" does not exist in the project

The target 'Metrics' the nuget 'Microsoft.CodeAnalysis.Metrics' is installed in each project.
This is the key. That target won't be available until after you've restored the nuget packages. The packages will have been restored on your local machine though.
For your build pipeline to work make sure you perform a restore first, either as part of the existing invocation of MSBuild, or as a seperate step.
MSBuild /t:restore;metrics ...
Or:
Msbuild /t:restore ...
Msbuild /t:metrics ...

Based on your description and concern, in your second shared task, for msbuildArgs: '/t:Metrics' in the task, the specified target File structure '/t:Metrics' is not completed, that's why you met this issue.
To solve this issue, you could define the target to folder level where the spevified csproj file located.
For example: File structure: xx->xxx->metrics ->xx.csproj
msbuildArgs: ”/t:xx\xxx\metrics“
For more information, you could also refer to the doc: How to: Build specific targets in solutions by using MSBuild.exe .

Related

VSBuild Fails with Error MSB4057 When Building with Azure Pipelines ('The target "<project_name>" does not exist in the project')

I am trying to run the VSBuild#1 task in an Azure Pipeline and every time it fails with the same error - "The target "<project_name>" does not exist in the project". I've searched for every answer to this question and none have worked for me. The exact yaml I'm running is
- task: VSBuild#1
displayName: 'Build Project1 and Project2'
inputs:
solution: '$(solution)'
msbuildArgs: '/t:Folder\Project1:Rebuild;Folder\Project2:Rebuild'
clean: true
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
The directory looks like 'Repo\Folder\Project1\Project1.csproj' and 'Repo\Folder\Project2\Project2.csproj' and the VSBuild version is 1.199.
You can run
set MSBuildEmitSolution=1
msbuild All.sln /t:<project_name>
Then search in the generated All.sln.metaproj file the exact target names () of all projects you want to build. After that you can build projects:
msbuild All.sln /t:"<project_name>" /p:Configuration=Release /p:Platform=x64

Retrieving the MSBuild content into an artifact? Directory 'D:\a\1\a' is empty. Nothing will be added to build artifact 'drop'

I try to understand how this MSBuild command is working with Azure DevOps Pipeline in Yaml. I get this error:
Here is my MSBuild instruction in my Azure Pipeline project:
- task: MSBuild#1
inputs:
solution: '**/Beper-EDI.sln'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArguments: # Optional
clean: true
#maximumCpuCount: false # Optional
#restoreNugetPackages: false # Optional
#logProjectEvents: false # Optional
#createLogFile: false # Optional
#logFileVerbosity: 'normal' # Optional. Options: quiet, minimal, normal, detailed,
The build is correct. I can build my project. Then I try to publish my artifact by using:
- task: PublishBuildArtifacts#1
inputs:
ArtifactName: 'drop'
pathToPublish: '$(Build.ArtifactStagingDirectory)'
I can process the pipeline but at the end my artifact is empty.
During my build I can see that the bin/Release folder and obj/Release folder are created and code is compiled.:
Starting: MSBuild
==============================================================================
Task : MSBuild
Description : Build with MSBuild
Version : 1.192.2
Author : Microsoft Corporation
Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/build/msbuild
==============================================================================
"D:\a\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.192.2\ps_modules\MSBuildHelpers\vswhere.exe" -version [17.0,18.0) -latest -format json
"D:\a\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.192.2\ps_modules\MSBuildHelpers\vswhere.exe" -version [17.0,18.0) -products Microsoft.VisualStudio.Product.BuildTools -latest -format json
"D:\a\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.192.2\ps_modules\MSBuildHelpers\vswhere.exe" -version [16.0,17.0) -latest -format json
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" "D:\a\1\s\Beper-EDI.sln" /nologo /nr:false /dl:CentralLogger,"D:\a\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.192.2\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=|SolutionDir=D:\a\1\s"*ForwardingLogger,"D:\a\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.192.2\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:platform="Any CPU" /p:configuration="Release" /p:_MSDeployUserAgent="VSTS_10aa52a5-54c3-4730-90df-e99d0388b1f5_build_50_0"
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
Build started 12/30/2021 8:07:45 AM.
Project "D:\a\1\s\Beper-EDI.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Release|Any CPU".
Project "D:\a\1\s\Beper-EDI.sln" (1) is building "D:\a\1\s\Nppg.Core.BusinessServices\Nppg.Core.BusinessServices.csproj" (2) on node 1 (default targets).
PrepareForBuild:
Creating directory "bin\Release\".
Creating directory "obj\Release\".
Project "D:\a\1\s\Nppg.Core.BusinessServices\Nppg.Core.BusinessServices.csproj" (2) is building "D:\a\1\s\Nppg.Core.Reports\Nppg.Core.Reports.csproj" (3:2) on node 1 (default targets).
PrepareForBuild:
Creating directory "bin\Release\".
Creating directory "obj\Release\".
Project "D:\a\1\s\Nppg.Core.Reports\Nppg.Core.Reports.csproj" (3:2) is building "D:\a\1\s\Submodules\nppg-core\Nppg.Core\Nppg.Core.csproj" (5:3) on node 1 (default targets).
PrepareForBuild:
Creating directory "bin\Release\".
Creating directory "obj\Release\".
How can I make sure the system let me access my /Release folder?
Retrieving the MSBuild content into an artifact? Directory 'D:\a\1\a' is empty. Nothing will be added to build artifact 'drop'
That because the source of the task PublishBuildArtifacts is $(Build.ArtifactStagingDirectory).
But the MSBuild task not generate the file in the $(Build.ArtifactStagingDirectory) folder, so we need to copy the files from the output folder of the task MSBuild to the folder $(Build.ArtifactStagingDirectory) by the copy task after MSBuild task:
- task: CopyFiles#2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: '**\bin\release\**'
TargetFolder: '$(Build.ArtifactStagingDirectory)'

Unable to generate artifacts in a Azure DevOps pipeline

I have created a Azure DevOps pipeline for my VB.net (.NET framework) project. Although, I am able to have the build pipeline successful, I am not seeing any artifacts generated for this. Not sure what I am doing wrong here. Appreciate if someone can help. Thank you.
My YAML File
trigger:
- Dev
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller#1
- task: NuGetCommand#2
inputs:
command: 'restore'
restoreSolution: '$(solution)'
- task: VSBuild#1
inputs:
solution: '$(solution)'
vsVersion: '16.0'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)\WebApp.zip"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
clean: true
- task: VSTest#2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: PublishBuildArtifacts#1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: 'drop'
Following is what I see in the run log for Azure DevOps
VS Build Logs:
2021-05-13T16:33:13.8214355Z ##[section]Starting: VSBuild
2021-05-13T16:33:13.8440350Z ==============================================================================
2021-05-13T16:33:13.8440703Z Task : Visual Studio build
2021-05-13T16:33:13.8441022Z Description : Build with MSBuild and set the Visual Studio version property
2021-05-13T16:33:13.8441289Z Version : 1.183.0
2021-05-13T16:33:13.8441508Z Author : Microsoft Corporation
2021-05-13T16:33:13.8441860Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/build/visual-studio-build
2021-05-13T16:33:13.8442594Z ==============================================================================
2021-05-13T16:33:16.7807662Z ##[command]"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.183.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [16.0,17.0) -latest -format json
2021-05-13T16:33:17.3715816Z ##[command]"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" "D:\a\1\s\BtuDia.sln" /nologo /nr:false /t:"Clean" /dl:CentralLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.183.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=f2cc1997-715f-4533-9cf5-809e154c58d8|SolutionDir=D:\a\1\s"*ForwardingLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.183.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="D:\a\1\a\WebApp.zip" /p:platform="Any CPU" /p:configuration="Release" /p:VisualStudioVersion="16.0" /p:_MSDeployUserAgent="VSTS_50ac3de3-2135-4b5c-a9b3-2b73c7988867_build_133_0"
2021-05-13T16:33:17.6709276Z Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
2021-05-13T16:33:18.2609764Z Build started 5/13/2021 4:33:18 PM.
2021-05-13T16:33:19.5083919Z Project "D:\a\1\s\BtuDia.sln" on node 1 (Clean target(s)).
2021-05-13T16:33:19.5097447Z ValidateSolutionConfiguration:
2021-05-13T16:33:19.5099659Z Building solution configuration "Release|Any CPU".
2021-05-13T16:33:19.5680685Z ##[warning]D:\a\1\s\BtuDia.sln.metaproj(0,0): Warning MSB4121: The project configuration for project "BtuDia" was not specified in the solution file for the solution configuration "Release|Any CPU".
2021-05-13T16:33:19.5693931Z D:\a\1\s\BtuDia.sln.metaproj : warning MSB4121: The project configuration for project "BtuDia" was not specified in the solution file for the solution configuration "Release|Any CPU". [D:\a\1\s\BtuDia.sln]
2021-05-13T16:33:19.8359709Z Project "D:\a\1\s\BtuDia.sln" (1) is building "D:\a\1\s\BtuDia.metaproj" (2) on node 1 (Clean target(s)).
2021-05-13T16:33:19.8366757Z Clean:
2021-05-13T16:33:19.8367729Z Web projects do not support the "Clean" target. Continuing with remaining projects ...
2021-05-13T16:33:19.8459255Z Done Building Project "D:\a\1\s\BtuDia.metaproj" (Clean target(s)).
2021-05-13T16:33:19.8660708Z Done Building Project "D:\a\1\s\BtuDia.sln" (Clean target(s)).
2021-05-13T16:33:19.8703982Z
2021-05-13T16:33:19.8704763Z Build succeeded.
2021-05-13T16:33:19.8820172Z
2021-05-13T16:33:19.8842817Z "D:\a\1\s\BtuDia.sln" (Clean target) (1) ->
2021-05-13T16:33:19.8843734Z (ValidateProjects target) ->
2021-05-13T16:33:19.8845021Z D:\a\1\s\BtuDia.sln.metaproj : warning MSB4121: The project configuration for project "BtuDia" was not specified in the solution file for the solution configuration "Release|Any CPU". [D:\a\1\s\BtuDia.sln]
2021-05-13T16:33:19.8845810Z
2021-05-13T16:33:19.8846120Z 1 Warning(s)
2021-05-13T16:33:19.8846392Z 0 Error(s)
2021-05-13T16:33:19.8846513Z
2021-05-13T16:33:19.8846801Z Time Elapsed 00:00:01.63
2021-05-13T16:33:19.9555158Z ##[command]"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" "D:\a\1\s\BtuDia.sln" /nologo /nr:false /dl:CentralLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.183.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=e520b37e-5959-4f7c-b65e-386d0792019a|SolutionDir=D:\a\1\s"*ForwardingLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.183.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="D:\a\1\a\WebApp.zip" /p:platform="Any CPU" /p:configuration="Release" /p:VisualStudioVersion="16.0" /p:_MSDeployUserAgent="VSTS_50ac3de3-2135-4b5c-a9b3-2b73c7988867_build_133_0"
2021-05-13T16:33:20.2085454Z Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
2021-05-13T16:33:20.3002560Z Build started 5/13/2021 4:33:20 PM.
2021-05-13T16:33:20.6526165Z Project "D:\a\1\s\BtuDia.sln" on node 1 (default targets).
2021-05-13T16:33:20.6539318Z ValidateSolutionConfiguration:
2021-05-13T16:33:20.6540673Z Building solution configuration "Release|Any CPU".
2021-05-13T16:33:20.6660965Z ##[warning]D:\a\1\s\BtuDia.sln.metaproj(0,0): Warning MSB4121: The project configuration for project "BtuDia" was not specified in the solution file for the solution configuration "Release|Any CPU".
2021-05-13T16:33:20.6667606Z D:\a\1\s\BtuDia.sln.metaproj : warning MSB4121: The project configuration for project "BtuDia" was not specified in the solution file for the solution configuration "Release|Any CPU". [D:\a\1\s\BtuDia.sln]
2021-05-13T16:33:20.8648353Z Project "D:\a\1\s\BtuDia.sln" (1) is building "D:\a\1\s\BtuDia.metaproj" (2) on node 1 (default targets).
2021-05-13T16:33:20.8649177Z Build:
2021-05-13T16:33:20.8649644Z C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /localhost_52471 -p BtuDia\ -u -f PrecompiledWeb\localhost_52471\
2021-05-13T16:33:39.1158371Z ##[warning]BtuDia\App_Code\classLocal.vb(6,0): Warning BC40056: Namespace or type specified in the Imports 'GrJhDll' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.
2021-05-13T16:33:39.1161745Z D:\a\1\s\BtuDia\App_Code\classLocal.vb(6): warning BC40056: Namespace or type specified in the Imports 'GrJhDll' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. [D:\a\1\s\BtuDia.metaproj]
2021-05-13T16:33:43.1733067Z ##[warning]BtuDia\Dia_File_Group_Session_Open.aspx.vb(272,0): Warning BC42104: Variable 'CloneTargets_Old' is used before it has been assigned a value. A null reference exception could result at runtime.
2021-05-13T16:33:43.1739019Z D:\a\1\s\BtuDia\Dia_File_Group_Session_Open.aspx.vb(272): warning BC42104: Variable 'CloneTargets_Old' is used before it has been assigned a value. A null reference exception could result at runtime. [D:\a\1\s\BtuDia.metaproj]
2021-05-13T16:33:43.1747520Z ##[warning]BtuDia\Dia_File_Group_Session_Open.aspx.vb(979,0): Warning BC42024: Unused local variable: 'i'.
2021-05-13T16:33:43.1751140Z D:\a\1\s\BtuDia\Dia_File_Group_Session_Open.aspx.vb(979): warning BC42024: Unused local variable: 'i'. [D:\a\1\s\BtuDia.metaproj]
2021-05-13T16:33:43.6445378Z Done Building Project "D:\a\1\s\BtuDia.metaproj" (default targets).
2021-05-13T16:33:43.6612251Z Done Building Project "D:\a\1\s\BtuDia.sln" (default targets).
2021-05-13T16:33:43.6700189Z
2021-05-13T16:33:43.6701164Z Build succeeded.
2021-05-13T16:33:43.6767010Z
2021-05-13T16:33:43.6778847Z "D:\a\1\s\BtuDia.sln" (default target) (1) ->
2021-05-13T16:33:43.6780435Z (ValidateProjects target) ->
2021-05-13T16:33:43.6785676Z D:\a\1\s\BtuDia.sln.metaproj : warning MSB4121: The project configuration for project "BtuDia" was not specified in the solution file for the solution configuration "Release|Any CPU". [D:\a\1\s\BtuDia.sln]
2021-05-13T16:33:43.6787616Z
2021-05-13T16:33:43.6787719Z
2021-05-13T16:33:43.6788094Z "D:\a\1\s\BtuDia.sln" (default target) (1) ->
2021-05-13T16:33:43.6788775Z "D:\a\1\s\BtuDia.metaproj" (default target) (2) ->
2021-05-13T16:33:43.6789290Z (Build target) ->
2021-05-13T16:33:43.6791152Z D:\a\1\s\BtuDia\App_Code\classLocal.vb(6): warning BC40056: Namespace or type specified in the Imports 'GrJhDll' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. [D:\a\1\s\BtuDia.metaproj]
2021-05-13T16:33:43.6792589Z D:\a\1\s\BtuDia\Dia_File_Group_Session_Open.aspx.vb(272): warning BC42104: Variable 'CloneTargets_Old' is used before it has been assigned a value. A null reference exception could result at runtime. [D:\a\1\s\BtuDia.metaproj]
2021-05-13T16:33:43.7077554Z D:\a\1\s\BtuDia\Dia_File_Group_Session_Open.aspx.vb(979): warning BC42024: Unused local variable: 'i'. [D:\a\1\s\BtuDia.metaproj]
2021-05-13T16:33:43.7078421Z
2021-05-13T16:33:43.7078905Z 4 Warning(s)
2021-05-13T16:33:43.7079179Z 0 Error(s)
2021-05-13T16:33:43.7082264Z
2021-05-13T16:33:43.7083041Z Time Elapsed 00:00:23.37
2021-05-13T16:33:43.7892410Z ##[section]Finishing: VSBuild
From your Yaml sample, you are using the Asp.Net template to build vb.net project. This template is not fully applicable to the vb.net.
So it will not generate the package in $(build.artifactstagingdirectory) path.
You could try to change the msbuildArgs (/p:OutputPath=$(build.artifactstagingdirectory))in VSBuild task.
Here is an example:
- task: VSBuild#1
displayName: 'Build solution'
inputs:
solution: '$(Parameters.solution)'
msbuildArgs: '/p:OutputPath=$(build.artifactstagingdirectory)'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
Or you could change the PathtoPublish in PublishBuildArtifacts task.
You could change the path to $(build.sourcesdirectory)/foldername/bin/Release.
- task: PublishBuildArtifacts#1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: '$(build.sourcesdirectory)/foldername/bin/Release'
ArtifactName: '$(Parameters.ArtifactName)'
condition: succeededOrFailed()

DotNetCLI#2 pack seems to be ignoring configuration inputs

The below YAML snippet does not seem to work as expected.
I configured it in a pipeline that runs using the windows-latest image and it attempts to restore all of the projects that are in the repo, instead of looking just to the solution file.
Also, it seems to completely ignore the --no-restore flag
- task: DotNetCoreCLI#2
displayName: Package to Staging directory
inputs:
command: pack
configuration: $(BUILD_CONFIGURATION)
projects: 'support-libs.sln'
packDirectory: $(Build.ArtifactStagingDirectory)
nugetConfigPath: 'sf-solution/nuget.config'
arguments: '--no-restore'
verbosityRestore: Minimal
The command that appears on the step logs is:
"C:\Program Files\dotnet\dotnet.exe" pack
d:\a\1\s\sf-solution\SampleProject\SampleProject.csproj --output
d:\a\1\a /p:Configuration=Debug --verbosity Detailed
The above project is not even included in the support-libs SLN file the snippet has configured.
The above project is not even included in the support-libs SLN file the snippet has configured
Not sure why DotNetCLI task pack the project, which is not included in in the support-libs SLN. Since you did not share your project file structure and the build log in your question, I could not give you the directly reason for this issue.
But as workaround, you could specify the specific project file instead of the solution file. Besides, you can also check this task by classic editor:
It state the path to csproj or nuspec file(s) to pack.
For the ignoring configuration inputs problem, there is an option Do Not build, so, you could add this argument to your pack task instead of the argument --no-restore:
- task: DotNetCoreCLI#2
displayName: 'dotnet pack'
inputs:
command: pack
packagesToPack: YourProjectPath&Name.csproj
nobuild: true
Note: Add a DotNet build task before you use this pack task.
Hope this helps.
I was finally able to do what I wanted and to pack all the libraries inside the solution, however I had to use a custom command instead of the pack one:
- task: DotNetCoreCLI#2
displayName: Package to Staging directory
inputs:
command: custom
custom: 'pack'
arguments: 'support-libs.sln -c=$(BUILD_CONFIGURATION) -o $(Build.ArtifactStagingDirectory)'
verbosityRestore: Minimal
verbosityPack: Minimal
feedsToUse: select
vstsFeed: personalnugetfeed
nuGetFeedType: internal
includeNuGetOrg: true
I was also having authorization issues with the internal feed that was in the Nuget configuration and linking to that file, even from a custom command, had the same issues.
Explicitly stating from which feed the restore should be made worked perfectly and I was able to retrieve all the dependencies removing the need to use the --no-restore flag.

VSTS Yaml vraiables and path contradicting with classic editor

I am facing an issue when setting VSTS classic editor parameters when compare with current yaml file which is working as expected.
Below is working fine (Build pipeline)
- task: CopyFiles#2
displayName: "Copy Files to: $(Build.ArtifactStagingDirectory)"
inputs:
contents: '$(Build.SourcesDirectory)/src/xxx.EndToEnd.Integration.Tests/**'
targetFolder: $(Build.ArtifactStagingDirectory)
- task: DotNetCoreCLI#2
displayName: "dotnet e2e tests"
inputs:
command: publish
publishWebProjects: false
projects: '**/*.csproj'
arguments: --output $(Build.ArtifactStagingDirectory)/src/xxx.EndToEnd.Integration.Tests
zipAfterPublish: false
But same setting as per below find 0 files
2019-04-06T10:02:57.5303667Z found 0 files
2019-04-06T10:02:57.5376614Z ##[section]Finishing: Copy Files to: $(Build.ArtifactStagingDirectory)
I have changed the / to \ as well, but same outcome.
Below is designer pipeline
Same results in dotnet publish task also in Path to project(s) parameter **\**\*.csprojgives below error, but above yaml file works as expected.
2019-04-06T10:02:58.7896707Z ##[error]Project file(s) matching the specified pattern were not found.
In the release pipeline the variables Build.SorucesDirectory and Build.ArtifactSatgingDirectory are not available, these variables are only for build pipelines.
In fact, in the release agent folder there is not "Soruces" folder, but only "Artifact" folder. for example: C:\agent\_work\r1\a, the variable to get the value is: System.ArtifactDirectory or Agent.ReleaseDirectory.
More details about release variables you can find here.