-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Open
Labels
Area: ABTTAkvelon Build Tasks Team area of workAkvelon Build Tasks Team area of workTask: Bashbugtriage
Description
New issue checklist
- I searched for existing GitHub issues
- I read pipeline troubleshooting guide
- I checked how to collect logs
Task name
DotNetCoreCLI@2
Task version
2.X.X
Issue Description
Inside a job, I have the following steps:
- bash: "echo $(DevExpress_License)"
env:
DevExpress_License: "${{ variables.DevExpress_License }}"
- task: "DotNetCoreCLI@2"
displayName: "dotnet build"
env:
DevExpress_License: "${{ variables.DevExpress_License }}"
inputs:
arguments: "--configuration Debug"
command: "build"
And I have a csproj with the following:
<Target Name="PrintDevExpressLicence" BeforeTargets="Build">
<Error Text="DevExpress_Licence - $(DevExpress_License)" />
</Target>
The result is that, the bash
is able to print the Environment variable.
And the MSBuild not, it fails showing "DevExpress_Licence - ".
The strange part is that sometimes this works.
Environment type (Please select at least one enviroment where you face this issue)
- Self-Hosted
- Microsoft Hosted
- VMSS Pool
- Container
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
Ubuntu 24.04
Relevant log output
Starting: dotnet build
==============================================================================
Task : .NET Core
Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command
Version : 2.258.1
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
==============================================================================
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.
/home/voltec/agent/_work/_tool/dotnet/dotnet build -dl:CentralLogger,"/home/voltec/agent/_work/_tasks/DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b/2.258.1/dotnet-build-helpers/Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll"*ForwardingLogger,"/home/voltec/agent/_work/_tasks/DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b/2.258.1/dotnet-build-helpers/Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" --configuration Debug
Determining projects to restore...
All projects are up-to-date for restore.
VMES.Worker.Contracts -> /home/voltec/agent/_work/4/s/artifacts/bin/VMES.Worker.Contracts/debug/VMES.Worker.Contracts.dll
VMES.Logic -> /home/voltec/agent/_work/4/s/artifacts/bin/VMES.Logic/debug/VMES.Logic.dll
##[error]src/VMES.Logic/VMES.Logic.csproj(14,3): Error : DevExpress_Licence -
/home/voltec/agent/_work/4/s/src/VMES.Logic/VMES.Logic.csproj(14,3): error : DevExpress_Licence -
VMES.Web.Api.Client -> /home/voltec/agent/_work/4/s/artifacts/bin/VMES.Web.Api.Client/debug/VMES.Web.Api.Client.dll
Build FAILED.
/home/voltec/agent/_work/4/s/src/VMES.Logic/VMES.Logic.csproj(14,3): error : DevExpress_Licence -
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:09.12
##[error]Error: The process '/home/voltec/agent/_work/_tool/dotnet/dotnet' failed with exit code 1
##[warning].NET 5 has some compatibility issues with older Nuget versions(<=5.7), so if you are using an older Nuget version(and not dotnet cli) to restore, then the dotnet cli commands (e.g. dotnet build) which rely on such restored packages might fail. To mitigate such error, you can either: (1) - Use dotnet cli to restore, (2) - Use Nuget version 5.8 to restore, (3) - Use global.json using an older sdk version(<=3) to build
Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . 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
##[error]Dotnet command failed with non-zero exit code on the following projects : [ '' ]
Finishing: dotnet build
Full task logs with system.debug enabled
[REPLACE THIS WITH YOUR INFORMATION]
Repro steps
jobs:
- job: "Build"
services:
mssql: "mssql"
steps:
- checkout: "self"
fetchDepth: 1
- task: "UseDotNet@2"
inputs:
useGlobalJson: true
- task: "NuGetAuthenticate@1"
- task: "DotNetCoreCLI@2"
displayName: "dotnet restore"
inputs:
command: "custom"
custom: "restore"
- bash: "echo $(DevExpress_License)"
env:
DevExpress_License: "${{ variables.DevExpress_License }}"
- task: "DotNetCoreCLI@2"
displayName: "dotnet build"
env:
DevExpress_License: "${{ variables.DevExpress_License }}"
inputs:
arguments: "--configuration Debug"
command: "build"
- task: DotNetCoreCLI@2
displayName: "dotnet format --no-restore --verify-no-changes"
inputs:
arguments: "--no-restore --verify-no-changes"
command: "custom"
custom: "format"
- task: "DotNetCoreCLI@2"
displayName: "dotnet test VMES.Erp.Tests"
inputs:
arguments: "--configuration Debug"
command: "test"
projects: "./tests/VMES.Erp.Tests/VMES.Erp.Tests.csproj"
- task: "DotNetCoreCLI@2"
displayName: "dotnet test VMES.Gateway.Tests"
inputs:
arguments: "--configuration Debug"
command: "test"
projects: "./tests/VMES.Gateway.Tests/VMES.Gateway.Tests.csproj"
- task: "DotNetCoreCLI@2"
displayName: "dotnet test VMES.Logic.Tests"
inputs:
arguments: "--configuration Debug"
command: "test"
projects: "./tests/VMES.Logic.Tests/VMES.Logic.Tests.csproj"
- task: "DotNetCoreCLI@2"
displayName: "dotnet test VMES.Web.Tests"
inputs:
arguments: "--configuration Debug"
command: "test"
projects: "./tests/VMES.Web.Tests/VMES.Web.Tests.csproj"
- task: "DotNetCoreCLI@2"
displayName: "dotnet publish VMES.Erp"
inputs:
arguments: "--configuration Release --output $(Build.ArtifactStagingDirectory)"
command: "publish"
projects: "./src/VMES.Erp/VMES.Erp.csproj"
publishWebProjects: false
- task: "DotNetCoreCLI@2"
displayName: "dotnet publish VMES.Gateway"
inputs:
arguments: "--configuration Release --output $(Build.ArtifactStagingDirectory)"
command: "publish"
projects: "./src/VMES.Gateway/VMES.Gateway.csproj"
publishWebProjects: false
- task: "DotNetCoreCLI@2"
displayName: "dotnet pack VMES.Logic"
inputs:
command: "pack"
configuration: "Release"
outputDir: "$(Build.ArtifactStagingDirectory)"
project: "./src/VMES.Logic/VMES.Logic.csproj"
- task: "DotNetCoreCLI@2"
displayName: "dotnet publish VMES.Web"
inputs:
arguments: "--configuration Release --output $(Build.ArtifactStagingDirectory)"
command: "publish"
projects: "./src/VMES.Web/VMES.Web.csproj"
publishWebProjects: false
- task: "DotNetCoreCLI@2"
displayName: "dotnet publish VMES.Worker"
inputs:
arguments: "--configuration Release --output $(Build.ArtifactStagingDirectory)"
command: "publish"
projects: "./src/VMES.Worker/VMES.Worker.csproj"
publishWebProjects: false
- publish: "$(Build.ArtifactStagingDirectory)"
pool:
name: "Default"
demands:
- "Agent.OS -equals Linux"
workspace:
clean: "all"
- deployment: "Deployment"
condition: "eq(variables['Build.SourceBranch'], 'refs/heads/release')"
dependsOn: "Build"
environment: "Production"
strategy:
runOnce:
deploy:
steps:
- task: "UseDotNet@2"
inputs:
version: "9.x"
- task: "NuGetAuthenticate@1"
- task: "DotNetCoreCLI@2"
displayName: "dotnet push"
inputs:
command: "push"
packagesToPush: "$(Agent.BuildDirectory)/Build/*.symbols.nupkg"
publishVstsFeed: "a739cd4b-2326-46a8-8ca6-4b29dc959323/0dd8700c-a6ce-494d-bae5-bcb95f06878a"
- task: "AzureWebApp@1"
inputs:
appName: "vmes-production"
azureSubscription: "vmes-production"
package: "$(Agent.BuildDirectory)/Build/VMES.Web.zip"
pool:
name: "Default"
demands:
- "Agent.OS -equals Linux"
workspace:
clean: "all"
resources:
containers:
- container: "mssql"
env:
ACCEPT_EULA: "true"
MSSQL_AGENT_ENABLED: "true"
MSSQL_BACKUP_DIR: "/var/opt/mssql/backup"
MSSQL_PID: "Developer"
MSSQL_SA_PASSWORD: "a random password"
image: "mcr.microsoft.com/mssql/server:2022-latest"
ports:
- "1433:1433/tcp"
schedules:
- cron: "0 0 * * *"
branches:
include:
- "main"
trigger:
- "main"
- "release"
variables:
- name: "DevExpress_License"
value: "the true licence"
Metadata
Metadata
Assignees
Labels
Area: ABTTAkvelon Build Tasks Team area of workAkvelon Build Tasks Team area of workTask: Bashbugtriage