ABP的版本升级,从7.2.2升级到7.2.3

发布时间 2023-07-04 12:23:35作者: 终南山人

1、升级ABP CLI

见前面的文章:ABP开发需要用到的命令

更新最新版本:
~~~
dotnet tool update -g Volo.Abp.Cli
~~~

2、升级ABP Suite

见前面的文章:ABP开发需要用到的命令

更新abp suite
~~~
abp suite update
~~~

第一步和第二步的截图命令行效果如下

**********************************************************************
** Visual Studio 2022 Developer PowerShell v17.6.4
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
PS X:\change\biz\Divination> dotnet tool update -g Volo.Abp.Cli
工具“volo.abp.cli”已成功从版本“7.2.2”更新到版本“7.2.3”。
PS X:\change\biz\Divination> abp suite update
ABP CLI 7.2.3
1. HTTP request attempt failed to https://raw.githubusercontent.com/abpframework/abp/dev/latest-versions.json with an error: The requested name is valid, but no data of the requested type was found. (raw.githubusercontent.com:443). Waiting 2 secs for the next try...
2. HTTP request attempt failed to https://raw.githubusercontent.com/abpframework/abp/dev/latest-versions.json with an error: The requested name is valid, but no data of the requested type was found. (raw.githubusercontent.com:443). Waiting 4 secs for the next try...
3. HTTP request attempt failed to https://raw.githubusercontent.com/abpframework/abp/dev/latest-versions.json with an error: The requested name is valid, but no data of the requested type was found. (raw.githubusercontent.com:443). Waiting 7 secs for the next try...
Updating ABP Suite ...
工具“volo.abp.suite”已成功从版本“7.2.2”更新到版本“7.2.3”。
PS X:\change\biz\Divination>

3、服务器端Gitlab Runner自动集成

Gitlab的流水线控制台界面,报出大量的错误:

$ dotnet build "src/Yee.Change.Common.Host/Yee.Change.Common.Host.csproj" -c Release -p:Version=$COMMON_VERSION_ID
MSBuild version 17.4.0+18d5aef85 for .NET
  Determining projects to restore...
/builds/xiPs9QzT/0/change/common/src/Yee.Change.Common.Domain/Yee.Change.Common.Domain.csproj : error NU1103: Unable to find a stable package Volo.Abp.Ddd.Domain with version (>= 7.2.3) [/builds/xiPs9QzT/0/change/common/src/Yee.Change.Common.Host/Yee.Change.Common.Host.csproj]
/builds/xiPs9QzT/0/change/common/src/Yee.Change.Common.Domain/Yee.Change.Common.Domain.csproj : error NU1103:   - Found 162 version(s) in nuget.amicap.cn [ Nearest version: 7.3.0-rc.1 ] [/builds/xiPs9QzT/0/change/common/src/Yee.Change.Common.Host/Yee.Change.Common.Host.csproj]
/builds/xiPs9QzT/0/change/common/src/Yee.Change.Common.Domain/Yee.Change.Common.Domain.csproj : error NU1103:   - Found 0 version(s) in abp [/builds/xiPs9QzT/0/change/common/src/Yee.Change.Common.Host/Yee.Change.Common.Host.csproj]
/builds/xiPs9QzT/0/change/common/src/Yee.Change.Common.Domain.Shared/Yee.Change.Common.Domain.Shared.csproj : error NU1103: Unable to find a stable package Volo.Abp.Validation with version (>= 7.2.3) [/builds/xiPs9QzT/0/change/common/src/Yee.Change.Common.Host/Yee.Change.Common.Host.csproj]
/builds/xiPs9QzT/0/change/common/src/Yee.Change.Common.Domain.Shared/Yee.Change.Common.Domain.Shared.csproj : error NU1103:   - Found 162 version(s) in nuget.amicap.cn [ Nearest version: 7.3.0-rc.1 ] [/builds/xiPs9QzT/0/change/common/src/Yee.Change.Common.Host/Yee.Change.Common.Host.csproj]
/builds/xiPs9QzT/0/change/common/src/Yee.Change.Common.Domain.Shared/Yee.Change.Common.Domain.Shared.csproj : error NU1103:   - Found 0 version(s) in abp [/builds/xiPs9QzT/0/change/common/src/Yee.Change.Common.Host/Yee.Change.Common.Host.csproj]
/builds/xiPs9QzT/0/change/common/src/Yee.Change.Common.Application.Contracts/Yee.Change.Common.Application.Contracts.csproj : error NU1103: Unable to find a stable package Volo.Abp.Ddd.Application.Contracts with version (>= 7.2.3) [/builds/xiPs9QzT/0/change/common/src/Yee.Change.Common.Host/Yee.Change.Common.Host.csproj]

原因是NuGet服务器里面,没有最新的ABP的7.2.3的包。我们的开发环境的NuGet服务器是基于Nexus 3搭建的,进入Nexus 3的管理界面,重置一下Nuget.org的代理的缓存。如下图所示:

1

再重新启动Gitlab的自动集成任务,一切正常了。

4、Blazor.Server.Host项目下的wwwroot目录中的libs文件夹的更新

1)删除yarn.lock

2

2) 执行命令abp install-libs

完整的命令执行日志如下

**********************************************************************
** Visual Studio 2022 Developer PowerShell v17.6.4
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
PS X:\change\biz\Divination\host\Yee.Change.Divination.Blazor.Server.Host> abp install-libs
ABP CLI 7.2.3
Found 1 projects.
X:\change\biz\Divination\host\Yee.Change.Divination.Blazor.Server.Host
Running Yarn on X:\change\biz\Divination\host\Yee.Change.Divination.Blazor.Server.Host
yarn install v1.22.19
info No lockfile found.
[1/4] Resolving packages...
warning @volo/abp.aspnetcore.mvc.ui.theme.leptonx > @volo/abp.aspnetcore.mvc.ui.theme.commercial > @abp/aspnetcore.mvc.ui.theme.shared > @abp/aspnetcore.mvc.ui > gulp > glob-watcher > chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
warning @volo/abp.aspnetcore.mvc.ui.theme.leptonx > @volo/abp.aspnetcore.mvc.ui.theme.commercial > @abp/aspnetcore.mvc.ui.theme.shared > @abp/aspnetcore.mvc.ui > gulp > glob-watcher > chokidar > fsevents@1.2.13: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2
warning @volo/abp.aspnetcore.mvc.ui.theme.leptonx > @volo/abp.aspnetcore.mvc.ui.theme.commercial > @abp/aspnetcore.mvc.ui.theme.shared > @abp/aspnetcore.mvc.ui > gulp > glob-watcher > anymatch > micromatch > snapdragon > source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
warning @volo/abp.aspnetcore.mvc.ui.theme.leptonx > @volo/abp.aspnetcore.mvc.ui.theme.commercial > @abp/aspnetcore.mvc.ui.theme.shared > @abp/aspnetcore.mvc.ui > gulp > glob-watcher > anymatch > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning @volo/abp.aspnetcore.mvc.ui.theme.leptonx > @volo/abp.aspnetcore.mvc.ui.theme.commercial > @abp/aspnetcore.mvc.ui.theme.shared > @abp/aspnetcore.mvc.ui > gulp > glob-watcher > anymatch > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning @volo/abp.aspnetcore.mvc.ui.theme.leptonx > @volo/abp.aspnetcore.mvc.ui.theme.commercial > @abp/aspnetcore.mvc.ui.theme.shared > @abp/aspnetcore.mvc.ui > gulp > glob-watcher > anymatch > micromatch > snapdragon > source-map-resolve > source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
warning @volo/cms-kit-pro.admin > @abp/cms-kit.admin > @abp/uppy > uppy > @uppy/core > cuid@2.1.8: Cuid and other k-sortable and non-cryptographic ids (Ulid, ObjectId, KSUID, all UUIDs) are all insecure. Use @paralleldrive/cuid2 instead.
warning @volo/cms-kit-pro.admin > @abp/cms-kit.admin > @abp/uppy > uppy > @uppy/aws-s3 > cuid@2.1.8: Cuid and other k-sortable and non-cryptographic ids (Ulid, ObjectId, KSUID, all UUIDs) are all insecure. Use @paralleldrive/cuid2 instead.
warning @volo/cms-kit-pro.admin > @abp/cms-kit.admin > @abp/uppy > uppy > @uppy/dashboard > cuid@2.1.8: Cuid and other k-sortable and non-cryptographic ids (Ulid, ObjectId, KSUID, all UUIDs) are all insecure. Use @paralleldrive/cuid2 instead.
warning @volo/cms-kit-pro.admin > @abp/cms-kit.admin > @abp/uppy > uppy > @uppy/dashboard > cuid@2.1.8: Cuid and other k-sortable and non-cryptographic ids (Ulid, ObjectId, KSUID, all UUIDs) are all insecure. Use @paralleldrive/cuid2 instead.
warning @volo/cms-kit-pro.admin > @abp/cms-kit.admin > @abp/uppy > uppy > @uppy/store-redux > cuid@2.1.8: Cuid and other k-sortable and non-cryptographic ids (Ulid, ObjectId, KSUID, all UUIDs) are all insecure. Use @paralleldrive/cuid2 instead.
warning @volo/cms-kit-pro.admin > @abp/cms-kit.admin > @abp/uppy > uppy > @uppy/xhr-upload > cuid@2.1.8: Cuid and other k-sortable and non-cryptographic ids (Ulid, ObjectId, KSUID, all UUIDs) are all insecure. Use @paralleldrive/cuid2 instead.
warning @volo/language-management > @abp/flag-icon-css > flag-icon-css@4.1.7: The project has been renamed to flag-icons
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "@volo/abp.aspnetcore.mvc.ui.theme.leptonx > @volo/abp.aspnetcore.mvc.ui.theme.commercial > @abp/aspnetcore.mvc.ui.theme.shared > @abp/bootstrap > bootstrap@5.3.0" has unmet peer dependency "@popperjs/core@^2.11.7".
[4/4] Building fresh packages...
success Saved lockfile.
Done in 35.47s.
PS X:\change\biz\Divination\host\Yee.Change.Divination.Blazor.Server.Host>

3)观察一下yarn.lock的改动

4

5、用dotnet ef升级数据库

1)执行dotnet ef migrations add

效果如下

**********************************************************************
** Visual Studio 2022 Developer PowerShell v17.6.4
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
PS X:\change\biz\Divination\host\Yee.Change.Divination.Web.Unified> dotnet ef migrations add ABP_upgrade_7.2.3
Build started...
Build succeeded.
Done. To undo this action, use 'ef migrations remove'
PS X:\change\biz\Divination\host\Yee.Change.Divination.Web.Unified>

2)Migrations目录下增加了一个文件,文件名就是上面第一步的命令后的参数

5

文件的内容如下

using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Yee.Change.Divination.Migrations
{
    /// <inheritdoc />
    public partial class ABPupgrade723 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<DateTimeOffset>(
                name: "LastPasswordChangeTime",
                table: "AbpUsers",
                type: "datetimeoffset",
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "ShouldChangePasswordOnNextLogin",
                table: "AbpUsers",
                type: "bit",
                nullable: false,
                defaultValue: false);

            migrationBuilder.CreateTable(
                name: "AbpUserDelegations",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
                    SourceUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    TargetUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    StartTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    EndTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpUserDelegations", x => x.Id);
                });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "AbpUserDelegations");

            migrationBuilder.DropColumn(
                name: "LastPasswordChangeTime",
                table: "AbpUsers");

            migrationBuilder.DropColumn(
                name: "ShouldChangePasswordOnNextLogin",
                table: "AbpUsers");
        }
    }
}

3)用dotnet ef database update命令,将上述改动提交到数据库中执行

**********************************************************************
** Visual Studio 2022 Developer PowerShell v17.6.4
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
PS X:\change\biz\Divination\host\Yee.Change.Divination.Web.Unified> dotnet ef migrations add ABP_upgrade_7.2.3
Build started...
Build succeeded.
Done. To undo this action, use 'ef migrations remove'
PS X:\change\biz\Divination\host\Yee.Change.Divination.Web.Unified> dotnet ef database update
Build started...
Build succeeded.
Applying migration '20230326101825_ABP_Upgrade_710'.
Applying migration '20230704040112_ABP_upgrade_7.2.3'.
Done.
PS X:\change\biz\Divination\host\Yee.Change.Divination.Web.Unified>

4)用数据库管理工具,查看数据库中的改动

6

至此,升级完成。