【问题标题】:Facing issue related to 'Microsoft.NETCore.App was not found while building the Azure pipeline构建 Azure 管道时未找到与“Microsoft.NETCore.App”相关的面临问题
【发布时间】:2022-06-27 12:11:21
【问题描述】:

我最近将我的包从 .net 3.1 升级到了 .net 6.0 。我在构建管道中遇到错误:找不到框架“Microsoft.NETCore.App”,版本“5.0.0”(x64)。

  • 找到了以下框架: 6.0.5 在 [C:\hostedtoolcache\windows\dotnet\shared\Microsoft.NETCore.App]

您可以通过安装指定的框架和/或 SDK 来解决问题。

指定的框架可以在:

请告诉我如何在 Azure 管道中解决此问题。

【问题讨论】:

  • 我认为你已经更新到 net5 而不是 net6。所以你可能想更新你的应用程序以定位 net6。默认情况下,代理上仅安装 LTS 版本的 dotnet。
  • 项目已更新为 .net 6 。我更改了项目属性。
  • 您粘贴的链接是针对 net5 的。
  • 升级软件包后,我在管道中收到此错误。

标签: azure azure-devops azure-functions azure-pipelines


【解决方案1】:

如果您的管道任务有问题,请确保您的代理设置为 YAML Windows 2022

如果您的管道使用 GUI,请将 SDK 设置为 6.0.102

设置代理的 YAML 代码

pool:  
vmImage: 'windows-2022'

variables:  
solution: '**/*.sln'  
buildPlatform: 'Any CPU'  
buildConfiguration: 'Release'

steps:  
- task: NuGetToolInstaller@1

-   task: PowerShell@2  
    inputs:  
    targetType: 'inline'  
    script: |  
    $newBuildNumber = echo ($(PowerShell_Version_Build_Number)+$(PowerShell_Version_Build_Number))  
    ((Get-Content -path Directory.Build.props -Raw) -replace 'BUILD_NUMBER', $newBuildNumber) | Set-Content -Path Directory.Build.props  
    workingDirectory: '$(Build.Repository.Your_Local_Directory_Path)'
    
-   task: PowerShell@2  
    inputs:  
    targetType: 'inline'  
    script: Get-Content -path Directory.Build.props -Raw  
    workingDirectory: '$(Build.Repository.Your_Local_Directory_Path)'
    
-   task: NuGetCommand@2  
    inputs:  
    restoreSolution: '$(solution)'
    
-   task: VSBuild@1  
    inputs:  
    solution: '$(solution)'  
    msbuildArgs: '[your_build_args]'  
    platform: '$(buildPlatform)'  
    configuration: '$(buildConfiguration)'
    
-   task: VSTest@2  
    inputs:  
    platform: '$(buildPlatform)'  
    configuration: '$(buildConfiguration)'
    
-   task: CopyFiles@2  
    displayName: 'Copying files'  
    condition: and(succeeded(), true)  
    inputs:  
    Contents: '[Project path]/bin/**'  
    TargetFolder: '$(Build.ArtifactStagingDirectory)/[Your_Project_path]'

【讨论】:

    猜你喜欢
    • 2023-01-11
    • 1970-01-01
    • 1970-01-01
    • 2019-01-03
    • 2020-09-10
    • 1970-01-01
    • 2021-03-27
    • 1970-01-01
    • 2022-07-25
    相关资源
    最近更新 更多