将.net core 2.2.0升级到2.2.6或更高版本

时间:2019-10-04 00:51:45

标签: asp.net-core

寻找将.net core 2.2.0升级到2.2.6或更高版本(不是3.0)的步骤

我是.net core的新手。因此,当推送到Pivotal Cloud Foundry时,由于应用程序出现故障,正在寻找有关如何将.net core 2.2升级到2.2.6的指南。我们的PCF环境dotnetcore buildpack版本是2.2.12;在使用2.2.5 build pack之前可以正常工作。请在下面找到错误消息。为了解决此错误,尽管将.net core应用程序升级到了高于2.2.5的版本。但想寻求有关升级应用程序和相应依赖项的步骤的帮助。

这是.csproj的目标框架

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>

依赖项是

  <ItemGroup>
    <PackageReference Include="AutoMapper" Version="8.1.0" />
    <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.1.0" />
    <PackageReference Include="CsvHelper" Version="12.1.2" />
    <PackageReference Include="EFCore.BulkExtensions" Version="2.4.6" />
    <PackageReference Include="FluentValidation.AspNetCore" Version="8.3.0" />
    <PackageReference Include="Manulife.Logging.DotNet" Version="1.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.AzureAD.UI" Version="2.2.0" />
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
    <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="2.2.4" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.4" />
    <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="2.2.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
    <PackageReference Include="Sendgrid" Version="9.11.0" />
    <PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
    <PackageReference Include="Steeltoe.CloudFoundry.Connector.EFCore" Version="2.2.0" />
    <PackageReference Include="Steeltoe.Extensions.Configuration.CloudFoundryCore" Version="2.2.0" />
    <PackageReference Include="Steeltoe.Extensions.Logging.DynamicLogger" Version="2.2.0" />
    <PackageReference Include="Steeltoe.Security.Authentication.CloudFoundryCore" Version="2.2.0" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
    <PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="4.0.1" />
    <PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
  </ItemGroup>

将应用程序推送到Pivotal时出错(在dotnet发布期间)

depends on runtime.linux-x64.Microsoft.NETCore.App (>= 2.2.5) but run 
time is not found. Picked up 2.2.6 which is available 
/tmp/app/Basischangeapp/Basischange.csproj : error NU1605: Detected 
package downgrade: Microsoft.NETCore.DotNetAppHost from 2.2.6 to 2.2.5. 
Reference the package directly from the project to select a different 
version.

1 个答案:

答案 0 :(得分:0)

之所以会发生,是因为本地SDK和构建服务器之间的版本不匹配。

将此行添加到您的.csproj文件中:

<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>

之后,RuntimeFrameworkVersion将使用LatestNetCorePatchVersion