DotNetCoreCLI publish command doesn't honor project path
See original GitHub issueQuestion, Bug, or Feature?
Type: Bug
Enter Task Name: DotNetCoreCLI https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/DotNetCoreCLIV2
Environment
Hosted Azure Pipelines, Ubuntu latest pool
Agent name: 'Hosted Agent'
Agent machine name: 'fv-az755'
Current agent version: '2.172.2'
Operating System
Ubuntu
18.04.4
LTS
Virtual Environment
Environment: ubuntu-18.04
Version: 20200726.1
Included Software: https://github.com/actions/virtual-environments/blob/ubuntu18/20200726.1/images/linux/Ubuntu1804-README.md
Current image version: '20200726.1'
Agent running as: 'vsts'
Issue Description
Running the following task configuration does not honor the projects
argument and actually publish the specified project. Instead, it goes to the root directory and publishes other projects.
- task: DotNetCoreCLI@2
inputs:
command: 'publish'
arguments: '-c Release'
projects: 'Website/Website.csproj'
When i use this simple script, the publish works as expected. See 2nd log output at the bottom.
- script: |
cd Website
dotnet publish -c Release
displayName: 'Publish Website package'
Task logs
Here is the failed log output from the command:
2020-07-30T15:53:48.7988181Z ##[section]Starting: DotNetCoreCLI
2020-07-30T15:53:48.8000981Z ==============================================================================
2020-07-30T15:53:48.8001275Z Task : .NET Core
2020-07-30T15:53:48.8001587Z Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command
2020-07-30T15:53:48.8001869Z Version : 2.172.2
2020-07-30T15:53:48.8002074Z Author : Microsoft Corporation
2020-07-30T15:53:48.8002389Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
2020-07-30T15:53:48.8002725Z ==============================================================================
2020-07-30T15:53:49.1678959Z Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version.
2020-07-30T15:53:49.2472243Z [command]/usr/bin/dotnet publish /home/vsts/work/1/s/Bot/SearchBot/SearchBot.csproj -c Release
2020-07-30T15:53:49.5281477Z Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Core
2020-07-30T15:53:49.5282031Z Copyright (C) Microsoft Corporation. All rights reserved.
2020-07-30T15:53:49.5282295Z
2020-07-30T15:53:49.9793586Z Determining projects to restore...
2020-07-30T15:53:53.9126529Z Restored /home/vsts/work/1/s/Bot/Shared/Shared.csproj (in 3.21 sec).
2020-07-30T15:53:54.0956580Z Restored /home/vsts/work/1/s/Bot/EntityModel/EntityModel.csproj (in 167 ms).
2020-07-30T15:53:54.4547293Z Restored /home/vsts/work/1/s/Bot/SearchBot/SearchBot.csproj (in 3.74 sec).
2020-07-30T15:53:56.8332971Z EntityModel -> /home/vsts/work/1/s/Bot/EntityModel/bin/Release/netcoreapp2.2/EntityModel.dll
2020-07-30T15:53:57.3743583Z Shared -> /home/vsts/work/1/s/Bot/Shared/bin/Release/netcoreapp2.2/Shared.dll
2020-07-30T15:53:57.9861603Z SearchBot -> /home/vsts/work/1/s/Bot/SearchBot/bin/Release/netcoreapp2.2/SearchBot.dll
2020-07-30T15:53:58.1385465Z SearchBot -> /home/vsts/work/1/s/Bot/SearchBot/bin/Release/netcoreapp2.2/publish/
2020-07-30T15:53:58.8232190Z [command]/usr/bin/dotnet publish /home/vsts/work/1/s/Bot/ServiceProviderBot/ServiceProviderBot.csproj -c Release
2020-07-30T15:53:59.0806347Z Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Core
2020-07-30T15:53:59.0807310Z Copyright (C) Microsoft Corporation. All rights reserved.
2020-07-30T15:53:59.0807705Z
2020-07-30T15:53:59.5096541Z Determining projects to restore...
2020-07-30T15:54:00.9660273Z Restored /home/vsts/work/1/s/Bot/ServiceProviderBot/ServiceProviderBot.csproj (in 1.13 sec).
2020-07-30T15:54:00.9740378Z 2 of 3 projects are up-to-date for restore.
2020-07-30T15:54:01.2878875Z EntityModel -> /home/vsts/work/1/s/Bot/EntityModel/bin/Release/netcoreapp2.2/EntityModel.dll
2020-07-30T15:54:01.4488471Z Shared -> /home/vsts/work/1/s/Bot/Shared/bin/Release/netcoreapp2.2/Shared.dll
2020-07-30T15:54:01.9897724Z ServiceProviderBot -> /home/vsts/work/1/s/Bot/ServiceProviderBot/bin/Release/netcoreapp2.2/ServiceProviderBot.dll
2020-07-30T15:54:02.1581902Z ServiceProviderBot -> /home/vsts/work/1/s/Bot/ServiceProviderBot/bin/Release/netcoreapp2.2/publish/
2020-07-30T15:54:02.6699097Z Info: Azure Pipelines hosted agents have been updated to contain .Net Core 3.x (3.1) SDK/Runtime along with 2.1. Unless you have locked down a SDK version for your project(s), 3.x SDK might be picked up which might have breaking behavior as compared to previous versions.
2020-07-30T15:54:02.6699862Z Some commonly encountered changes are:
2020-07-30T15:54:02.6701373Z If you're using `Publish` command with -o or --Output argument, you will see that the output folder is now being created at root directory rather than Project File's directory. To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
2020-07-30T15:54:02.6748494Z ##[section]Finishing: DotNetCoreCLI
Here is the successful log output from the script:
2020-07-30T16:02:30.8855479Z ##[section]Starting: Publish Website
2020-07-30T16:02:30.8862025Z ==============================================================================
2020-07-30T16:02:30.8862348Z Task : Command line
2020-07-30T16:02:30.8862659Z Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
2020-07-30T16:02:30.8862968Z Version : 2.164.2
2020-07-30T16:02:30.8863208Z Author : Microsoft Corporation
2020-07-30T16:02:30.8863560Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
2020-07-30T16:02:30.8863920Z ==============================================================================
2020-07-30T16:02:31.2892629Z Generating script.
2020-07-30T16:02:31.2906136Z ========================== Starting Command Output ===========================
2020-07-30T16:02:31.2934282Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/e4973225-b598-44f5-8ba2-d62218f278a6.sh
2020-07-30T16:02:31.7465895Z
2020-07-30T16:02:31.9162271Z Welcome to .NET Core 3.1!
2020-07-30T16:02:31.9170620Z ---------------------
2020-07-30T16:02:31.9171686Z SDK Version: 3.1.302
2020-07-30T16:02:31.9172312Z
2020-07-30T16:02:31.9173001Z Telemetry
2020-07-30T16:02:31.9174039Z ---------
2020-07-30T16:02:31.9175748Z The .NET Core tools collect usage data in order to help us improve your experience. The data is anonymous. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.
2020-07-30T16:02:31.9176888Z
2020-07-30T16:02:31.9177856Z Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry
2020-07-30T16:02:31.9178520Z
2020-07-30T16:02:31.9179280Z ----------------
2020-07-30T16:02:31.9180138Z Explore documentation: https://aka.ms/dotnet-docs
2020-07-30T16:02:31.9181007Z Report issues and find source on GitHub: https://github.com/dotnet/core
2020-07-30T16:02:31.9181798Z Find out what's new: https://aka.ms/dotnet-whats-new
2020-07-30T16:02:31.9182635Z Learn about the installed HTTPS developer cert: https://aka.ms/aspnet-core-https
2020-07-30T16:02:31.9183896Z Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs
2020-07-30T16:02:31.9184979Z Write your first app: https://aka.ms/first-net-core-app
2020-07-30T16:02:31.9185683Z --------------------------------------------------------------------------------------
2020-07-30T16:02:33.8072608Z Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Core
2020-07-30T16:02:33.8074007Z Copyright (C) Microsoft Corporation. All rights reserved.
2020-07-30T16:02:33.8074742Z
2020-07-30T16:02:37.2775274Z Determining projects to restore...
2020-07-30T16:02:52.8154500Z Restored /home/vsts/work/1/s/Website/Website.csproj (in 13.99 sec).
2020-07-30T16:03:03.1158423Z Website -> /home/vsts/work/1/s/Website/bin/Release/netcoreapp3.1/Website.dll
2020-07-30T16:03:03.1180575Z Website -> /home/vsts/work/1/s/Website/bin/Release/netcoreapp3.1/Website.Views.dll
2020-07-30T16:03:46.3540234Z
2020-07-30T16:03:46.3566456Z > node-sass@4.14.1 install /home/vsts/work/1/s/Website/ClientApp/node_modules/node-sass
2020-07-30T16:03:46.3567700Z > node scripts/install.js
2020-07-30T16:03:46.3568516Z
2020-07-30T16:03:46.4612627Z Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/linux-x64-72_binding.node
2020-07-30T16:03:47.0642367Z Download complete
2020-07-30T16:03:47.0741130Z Binary saved to /home/vsts/work/1/s/Website/ClientApp/node_modules/node-sass/vendor/linux-x64-72/binding.node
2020-07-30T16:03:47.1137047Z Caching binary to /home/vsts/.npm/node-sass/4.14.1/linux-x64-72_binding.node
2020-07-30T16:03:47.3145718Z
2020-07-30T16:03:47.3169025Z > core-js@2.6.11 postinstall /home/vsts/work/1/s/Website/ClientApp/node_modules/core-js
2020-07-30T16:03:47.3171411Z > node -e "try{require('./postinstall')}catch(e){}"
2020-07-30T16:03:47.3191776Z
2020-07-30T16:03:48.8619444Z [96mThank you for using core-js ([94m https://github.com/zloirock/core-js [96m) for polyfilling JavaScript standard library![0m
2020-07-30T16:03:48.8629157Z
2020-07-30T16:03:48.8650748Z [96mThe project needs your help! Please consider supporting of core-js on Open Collective or Patreon: [0m
2020-07-30T16:03:48.8661936Z [96m>[94m https://opencollective.com/core-js [0m
2020-07-30T16:03:48.8662490Z [96m>[94m https://www.patreon.com/zloirock [0m
2020-07-30T16:03:48.8662715Z
2020-07-30T16:03:48.8663274Z [96mAlso, the author of core-js ([94m https://github.com/zloirock [96m) is looking for a good job -)[0m
2020-07-30T16:03:48.8663606Z
2020-07-30T16:03:48.8663747Z
2020-07-30T16:03:48.8664244Z > core-js-pure@3.6.5 postinstall /home/vsts/work/1/s/Website/ClientApp/node_modules/core-js-pure
2020-07-30T16:03:48.8664784Z > node -e "try{require('./postinstall')}catch(e){}"
2020-07-30T16:03:48.8665016Z
2020-07-30T16:03:48.8665140Z
2020-07-30T16:03:48.8665693Z > core-js@3.6.5 postinstall /home/vsts/work/1/s/Website/ClientApp/node_modules/react-app-polyfill/node_modules/core-js
2020-07-30T16:03:48.8666301Z > node -e "try{require('./postinstall')}catch(e){}"
2020-07-30T16:03:48.8666514Z
2020-07-30T16:03:48.8666635Z
2020-07-30T16:03:48.8667124Z > node-sass@4.14.1 postinstall /home/vsts/work/1/s/Website/ClientApp/node_modules/node-sass
2020-07-30T16:03:48.8667460Z > node scripts/build.js
2020-07-30T16:03:48.8667620Z
2020-07-30T16:03:48.8668149Z Binary found at /home/vsts/work/1/s/Website/ClientApp/node_modules/node-sass/vendor/linux-x64-72/binding.node
2020-07-30T16:03:48.8668495Z Testing binary
2020-07-30T16:03:48.8668666Z Binary is fine
2020-07-30T16:03:49.8068608Z npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
2020-07-30T16:03:49.8091058Z npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2020-07-30T16:03:49.8155635Z npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
2020-07-30T16:03:49.8160516Z npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2020-07-30T16:03:49.8197607Z npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/jest-haste-map/node_modules/fsevents):
2020-07-30T16:03:49.8206871Z npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2020-07-30T16:03:49.8246505Z npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/fsevents):
2020-07-30T16:03:49.8247211Z npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2020-07-30T16:03:49.8251152Z
2020-07-30T16:03:49.8313166Z added 1833 packages from 882 contributors and audited 1845 packages in 35.902s
2020-07-30T16:03:51.0100388Z
2020-07-30T16:03:51.0140407Z 71 packages are looking for funding
2020-07-30T16:03:51.0141994Z run `npm fund` for details
2020-07-30T16:03:51.0143403Z
2020-07-30T16:03:51.0156337Z found 1 low severity vulnerability
2020-07-30T16:03:51.0156744Z run `npm audit fix` to fix them, or `npm audit` for details
2020-07-30T16:03:51.3904664Z
2020-07-30T16:03:51.3905344Z > tira@0.1.0 build /home/vsts/work/1/s/Website/ClientApp
2020-07-30T16:03:51.3906355Z > react-scripts build
2020-07-30T16:03:51.3906865Z
2020-07-30T16:03:52.7233264Z Creating an optimized production build...
2020-07-30T16:04:08.3341417Z Compiled successfully.
2020-07-30T16:04:08.3343610Z
2020-07-30T16:04:08.3344117Z File sizes after gzip:
2020-07-30T16:04:08.3345153Z
2020-07-30T16:04:08.3345980Z 49.92 KB build/static/js/2.152536c8.chunk.js
2020-07-30T16:04:08.3346449Z 22.47 KB build/static/css/2.829c9cb5.chunk.css
2020-07-30T16:04:08.3347203Z 2.03 KB build/static/js/main.1a82b7d2.chunk.js
2020-07-30T16:04:08.3348309Z 768 B build/static/js/runtime-main.66199951.js
2020-07-30T16:04:08.3348775Z 446 B build/static/css/main.55cb4151.chunk.css
2020-07-30T16:04:08.3349127Z
2020-07-30T16:04:08.3349477Z The project was built assuming it is hosted at /.
2020-07-30T16:04:08.3349947Z You can control this with the homepage field in your package.json.
2020-07-30T16:04:08.3350299Z
2020-07-30T16:04:08.3350629Z The build folder is ready to be deployed.
2020-07-30T16:04:08.3351041Z You may serve it with a static server:
2020-07-30T16:04:08.3351398Z
2020-07-30T16:04:08.3351967Z npm install -g serve
2020-07-30T16:04:08.3352466Z serve -s build
2020-07-30T16:04:08.3352775Z
2020-07-30T16:04:08.3353100Z Find out more about deployment here:
2020-07-30T16:04:08.3353436Z
2020-07-30T16:04:08.3353865Z bit.ly/CRA-deploy
2020-07-30T16:04:08.3354177Z
2020-07-30T16:04:08.3354809Z Website -> /home/vsts/work/1/s/Website/bin/Release/netcoreapp3.1/publish/
2020-07-30T16:04:08.3355173Z
2020-07-30T16:04:08.3382778Z ##[section]Finishing: Publish Website
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Azure Pipeline Publish: task DotNetCoreCLI with specific ...
It correctly executed the publish command for the backend folder. The only thing is that it built the zips for all the projects...
Read more >dotnet publish command does not accept workingDirectory or ...
The publish command does not properly accept a workingDirectory or projects parameter so you can only specify a single project.
Read more >DotNetCoreCLI@2 - .NET Core v2 task - Microsoft Learn
Use when command = publish. Add project's folder name to publish path. Default: true. #packagesToPush: '$(Build.
Read more >Azure DevOps Publish Artifacts for ASP.NET Core
The pipeline will currently tell us if the included project builds, but doesn't provide us with the results of that build. Using the...
Read more >Using Azure Pipelines to publish the NuGet package from ...
Note that the string in YAML does not need to be quoted. ... You can host your project on Azure DevOps Repo or...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thank you @tejasd1990 for your reply, from what I understood you propose to name the projects accordingly to the sequence that they have to be compiled which might work but I think it’s expected when you publish a specific project on azure DevOps to behave just like publishing on Visual Studio or with dotnet command (shown in my previous post) which would publish just the specific project that you selected and not the other projects in the solution, of course, the other projects also have to be compiled if the current project has dependency set on them but not published. Anyway, I’ve managed to get the pipeline working and I’m using the workaround that I presented.
Hi @dtzar @rsegecin , let me know if the workaround unblocks you, the behavior is the expected task functionality and we won’t be changing it. Will close this issue, thanks.