gpt4 book ai didi

c# - 进程 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' 失败,退出代码 1

转载 作者:行者123 更新时间:2023-12-02 22:58:48 26 4
gpt4 key购买 nike

我的问题是我在.net core 2.2中创建了一个项目,问题是我尝试使用azure pipelines部署它,但是当使用dotnet Restore时它不断失败并结束构建。

它返回的错误如下:

2020-11-21T20:17:30.4639428Z ##[error]**Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1**

2020-11-21T20:17:30.4652823Z ##[error]**Packages failed to restore**

2020-11-21T20:17:30.4655465Z **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-11-21T20:17:30.4656214Z Some commonly encountered changes are:
2020-11-21T20:17:30.4657227Z 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://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
2020-11-21T20:17:30.4661682Z ##[section]Finishing: dotnet restore

我尝试安装版本2.2以在恢复之前的过程中使用,我尝试使用nuget.config和global.json。我将我用过的.yml留在这里,看看是否有人可以提供我伸出一只手。

steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 2.2.x'
inputs:
version: 2.2.x
includePreviewVersions: true
performMultiLevelLookup: true

- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: restore
projects: '**/*.csproj'

- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.4.1'
inputs:
versionSpec: 4.4.1
checkLatest: true

- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(Parameters.solution)'

- task: VSBuild@1
displayName: 'Build solution'
inputs:
solution: '$(Parameters.solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'

- task: PublishSymbols@2
displayName: 'Publish symbols path'
inputs:
SearchPattern: '**\bin\**\*.pdb'
PublishSymbols: false
continueOnError: true

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: '$(Parameters.ArtifactName)'
condition: succeededOrFailed()

最佳答案

我已经使用以下 yaml 文件对 .net core 2.2 项目进行了测试,并获得了成功的结果。

trigger:
- master

pool:
vmImage: 'windows-latest'

steps:
- task: UseDotNet@2
inputs:
version: '2.2.x'
includePreviewVersions: true
performMultiLevelLookup: true
- task: DotNetCoreCLI@2
inputs:
command: 'restore'
projects: '**/*.csproj'

为了缩小问题范围,我建议您:

  1. 创建一个简单的 .net core 2.2 项目并推送到 DevOps,为此项目创建管道以查看是否可以重现此问题。
  2. 将项目克隆到本地,并在本地运行 dotnet restore 命令查看结果如何。

关于c# - 进程 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' 失败,退出代码 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64947880/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com