【发布时间】:2022-01-15 15:18:22
【问题描述】:
nuget 命令失败,退出代码 (1) 和错误 (C:\Program Files\dotnet\sdk\5.0.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(141, 5):错误NETSDK1045:当前.NET SDK不支持面向.NET 6.0。要么面向.NET 5.0或更低版本,要么使用支持.NET 6.0的.NET SDK版本。[D:\a\1\ s\app-code\app-code.csproj
我在上面遇到错误。 我正在使用只有 .net 6 的 Visual Studio 代码 2022 这是我的 yaml 文件代码:
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
第一次使用 yaml,谁能告诉我如何调整 .net 版本以及在哪里添加什么代码。 很抱歉在写这个问题时出现任何错误。
【问题讨论】:
标签: asp.net azure-devops yaml azure-pipelines-yaml azure-webapps