microsoft / azure-pipelines-yaml

Azure Pipelines YAML examples, templates, and community interaction
MIT License
1.21k stars 934 forks source link

command: publish Error: dotnet.exe failed with return code: 1 Dotnet command failed with non-zero exit code on the following projects : #466

Closed loviji closed 4 years ago

loviji commented 4 years ago

BUILD pipeline return error on publish stage on .NET CORE web application yaml file content

pool:
  vmImage: 'vs2017-win2016'

variables:
  buildConfiguration: 'Release'

steps:
- script: dotnet restore

- script: dotnet build --configuration $(buildConfiguration)
  displayName: 'dotnet build $(buildConfiguration)'

- task: DotNetCoreCLI@2
  inputs:
    command: publish
    publishWebProjects: True
    arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
    zipAfterPublish: True 

- task: PublishBuildArtifacts@1    
  displayName: 'Publish Artifact: drop'
  inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'

ERROR TEXT:

[section]Starting: DotNetCoreCLI

============================================================================== Task : .NET Core Description : Build, test, package, or publish a dotnet application, or run a custom dotnet >command. For package commands, supports NuGet.org and authenticated feeds like Package >Management and MyGet. Version : 2.141.6 Author : Microsoft Corporation Help : More Information

[command]C:\Windows\system32\chcp.com 65001 Active code page: 65001 [command]"C:\Program Files\dotnet\dotnet.exe" publish "C:\gitAgent_work\2\s\C. NameSpace.ProjectName.WebUI\D. NameSpace.ProjectName.WebUI.csproj" --configuration Release --output C:\gitAgent_work\2\a\C. ProSys.FMS.WebUI Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1008: Only one project can be specified. Switch: ProSys.FMS.WebUI

For switch syntax, type "MSBuild -help" **> ##error]Error: C:\Program Files\dotnet\dotnet.exe failed with return code: 1

[error]Dotnet command failed with non-zero exit code on the following projects : C:\gitAgent_work\2\s\C. NameSpace.ProjectName.WebUI\D. NameSpace.ProjectName.WebUI.csproj

[section]Finishing: DotNetCoreCLI**

csproj file include this entries: `

true
<TargetFramework>netcoreapp2.2</TargetFramework>
<!--<AspNetCoreModuleName>AspNetCoreModuleV2</AspNetCoreModuleName>
<AspNetCoreHostingModel>inprocess</AspNetCoreHostingModel>-->
<TypeScriptToolsVersion>2.8</TypeScriptToolsVersion>
<RootNamespace>NameSpace.ProjectName.WebUI</RootNamespace>
<AssemblyName>NameSpace.ProjectName.WebUI</AssemblyName>
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
<UserSecretsId>9f0c03de-2d39-43f7-9353-9cf89e8ee271</UserSecretsId>

`

loviji commented 4 years ago

solution found as https://stackoverflow.com/questions/55557524/how-do-i-publish-using-azure-devops. Ticket can be closed.