Azure devops Azure devops.netcore失败,但在visual studio中构建良好

Azure devops Azure devops.netcore失败,但在visual studio中构建良好,azure-devops,azure-deployment,Azure Devops,Azure Deployment,--修正了。。。哎呀,这东西真是太简陋了。 Microsoft链接以解释如何操作 我必须从csproj文件中的Microsoft.AspNetCore.All引用中删除版本标记 <ItemGroup> <PackageReference Include="Microsoft.AspNetCore.All" **DELETE Version Version="2.2.0" /> 我不知道现在该怎么办 -- 在azure devops中构建或从VS发布到azure应用

--修正了。。。哎呀,这东西真是太简陋了。
Microsoft链接以解释如何操作

我必须从csproj文件中的Microsoft.AspNetCore.All引用中删除版本标记

<ItemGroup>
  <PackageReference Include="Microsoft.AspNetCore.All" **DELETE Version Version="2.2.0" />
我不知道现在该怎么办

-- 在azure devops中构建或从VS发布到azure应用程序服务时,我遇到以下错误。VisualStudio可以很好地构建它

(恢复目标)->2018-12-04T01:30:44.4900171Z D:\a\1\s\cbw.services\cbw.mvc.services.csproj:错误NU1202:包 Microsoft.AspNetCore.All 2.2.0与netcoreapp2.1不兼容 (.NETCoreApp,版本=v2.1)。软件包Microsoft.AspNetCore.All 2.2.0 支持:netcoreapp2.2(.NETCoreApp,版本=v2.2)

我的身材

resources:
- repo: self
queue:
  name: Hosted VS2017
steps:
- task: DotNetCoreInstaller@0
  displayName: 'Use .NET Core Tool Installer'
  inputs:
    version: 2.1.500
- task: NuGetToolInstaller@0
  displayName: 'Use NuGet 4.9.1'
  inputs:
    versionSpec: 4.9.1
#- task: NuGetCommand@2
#  displayName: 'NuGet restore'
#  inputs:
#    restoreSolution: '***.sln'
#    feedsToUse: config
#    nugetConfigPath: 'NuGet.config'
#    externalFeedCredentials: <Name of the NuGet service connection>
- task: DotNetCoreCLI@2
  displayName: Restore
  inputs:
    command: restore
    projects: '**/*.sln'
    feedsToUse: config
    nugetConfigPath: NuGet.config
- task: DotNetCoreCLI@2
  displayName: Build
  inputs:
    projects: '**/*.sln'
    arguments: '--configuration $(BuildConfiguration)'
- task: DotNetCoreCLI@2
  displayName: Test
  inputs:
    command: test
    projects: '**/*Tests/*.csproj)'
    arguments: '--configuration $(BuildConfiguration)'
#- task: DotNetCoreCLI@2
#  displayName: Publish
#  inputs:
#    command: publish
#    publishWebProjects: True
#    arguments: 'release --output $(build.artifactstagingdirectory)'
- task: DotNetCoreCLI@2
  displayName: 'dotnet publish'
  inputs:
    command: 'publish'
    publishWebProjects: True
    projects:  '**/*.sln'
    arguments: release -o $(build.artifactStagingDirectory)
    zipAfterPublish: True
    modifyOutputPath: false
- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact'
  inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'
- task: AzureRmWebAppDeployment@3
  inputs:
    azureSubscription: 'Azure CBW Dev'
    WebAppName: 'cbwServicesDev'
    Package: $(System.artifactstagingdirectory)/**/*.zip 
资源:
-回购:自我
队列:
名称:托管VS2017
步骤:
-任务:DotNetCoreInstaller@0
displayName:“使用.NET核心工具安装程序”
投入:
版本:2.1.500
-任务:NuGetToolInstaller@0
displayName:“使用NuGet 4.9.1”
投入:
版本规范:4.9.1
#-任务:NuGetCommand@2
#displayName:“NuGet还原”
#投入:
#恢复解决方案:'***.sln'
#feedsToUse:config
#nugetConfigPath:'NuGet.config'
#外部FeedCredentials:
-任务:DotNetCoreCLI@2
显示名称:还原
投入:
命令:还原
项目:“***.sln”
feedsToUse:config
nugetConfigPath:NuGet.config
-任务:DotNetCoreCLI@2
显示名称:构建
投入:
项目:“***.sln”
参数:'--configuration$(BuildConfiguration)'
-任务:DotNetCoreCLI@2
显示名称:测试
投入:
命令:test
项目:“***测试/*.csproj”
参数:'--configuration$(BuildConfiguration)'
#-任务:DotNetCoreCLI@2
#显示名称:发布
#投入:
#命令:发布
#publishWebProjects:正确
#参数:'release--output$(build.artifactstagingdirectory)'
-任务:DotNetCoreCLI@2
displayName:“dotnet发布”
投入:
命令:“发布”
publishWebProjects:正确
项目:“***.sln”
参数:release-o$(build.artifactStagingDirectory)
zipAfterPublish:对
modifyOutputPath:false
-任务:PublishBuildArtifacts@1
displayName:“发布工件”
投入:
PathtoPublish:“$(build.artifactstagingdirectory)”
-任务:AzureRmWebAppDeployment@3
投入:
azureSubscription:“Azure CBW开发”
WebAppName:'cbwServicesDev'
包:$(System.artifactstagingdirectory)/***.zip

您需要将.NET核心SDK安装程序任务添加到构建中

编辑:它必须是第一个任务,或者至少在任何构建任务之前

Scott Hanselman的一篇好文章将带您解决这个问题


错误表明您需要在生成代理上安装dotnet core 2.2(而不是2.1)?看起来Asp Net core 2.2.0已经在nuget中发布。但是.NETCore2.2还没有正式发布…@Aries我似乎记得他们对ASP.NETCore2.1做了完全相同的事情!
resources:
- repo: self
queue:
  name: Hosted VS2017
steps:
- task: DotNetCoreInstaller@0
  displayName: 'Use .NET Core Tool Installer'
  inputs:
    version: 2.1.500
- task: NuGetToolInstaller@0
  displayName: 'Use NuGet 4.9.1'
  inputs:
    versionSpec: 4.9.1
#- task: NuGetCommand@2
#  displayName: 'NuGet restore'
#  inputs:
#    restoreSolution: '***.sln'
#    feedsToUse: config
#    nugetConfigPath: 'NuGet.config'
#    externalFeedCredentials: <Name of the NuGet service connection>
- task: DotNetCoreCLI@2
  displayName: Restore
  inputs:
    command: restore
    projects: '**/*.sln'
    feedsToUse: config
    nugetConfigPath: NuGet.config
- task: DotNetCoreCLI@2
  displayName: Build
  inputs:
    projects: '**/*.sln'
    arguments: '--configuration $(BuildConfiguration)'
- task: DotNetCoreCLI@2
  displayName: Test
  inputs:
    command: test
    projects: '**/*Tests/*.csproj)'
    arguments: '--configuration $(BuildConfiguration)'
#- task: DotNetCoreCLI@2
#  displayName: Publish
#  inputs:
#    command: publish
#    publishWebProjects: True
#    arguments: 'release --output $(build.artifactstagingdirectory)'
- task: DotNetCoreCLI@2
  displayName: 'dotnet publish'
  inputs:
    command: 'publish'
    publishWebProjects: True
    projects:  '**/*.sln'
    arguments: release -o $(build.artifactStagingDirectory)
    zipAfterPublish: True
    modifyOutputPath: false
- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact'
  inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'
- task: AzureRmWebAppDeployment@3
  inputs:
    azureSubscription: 'Azure CBW Dev'
    WebAppName: 'cbwServicesDev'
    Package: $(System.artifactstagingdirectory)/**/*.zip