代码改变世界

天行健,君子以自强不息

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  108 随笔 :: 0 文章 :: 3 评论 :: 22127 阅读
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

0、命令行在哪里执行?

在Visual Studio的“解决方案资源管理器”的解决方案或者项目上点鼠标右键,选择“在终端中打开”。

1、安装abp的命令行

官网文档地址:https://docs.abp.io/en/abp/latest/CLIABP CLI 是一个 dotnet global tool. 使用命令行窗口安装:

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

2、安装abp的商业版的客户端工具:ABP Suite

PS D:\dev\gitlab\brain> abp login zh*****ng
[20:46:07 INF] ABP CLI (https://abp.io)
[20:46:07 INF] Version 4.4.4 (Stable)
Password: [20:46:20 INF] Successfully logged in as 'zh****ng'

3、安装abp suite

在安装了abp,并且登入了abp账号之后,用abp suite install即可

**
**********************************************************************
** Visual Studio 2022 Developer PowerShell v17.0.2
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************

PS D:\dev\gitlab\brain> abp suite install
[20:44:02 INF] ABP CLI (https://abp.io)
[20:44:02 INF] Version 4.4.4 (Stable)
[20:44:12 INF] Installing ABP Suite latest version...
[20:44:12 WRN] You are not signed in! Use the CLI command "abp login <username>" to sign in, then try again.
PS D:\dev\gitlab\brain>
**

4、更新abp suite

  • 先更新
abp~~~dotnet tool update -g Volo.Abp.Cli
  • 再更新
abp suite~~~abp suite update

有时候abp suite的某个版本可能会有bug,比如8.0版本就出现了严重的bug,官方给出的更新方法如下

I have updated ABP Suite from the server (for this bugfix), so please follow the below steps:
1.) Uninstall ABP Suite:
dotnet tool uninstall -g Volo.Abp.Suite
2.) Clear NuGet caches:
dotnet nuget locals all --clear
3.) Re-install ABP Suite:
abp suite install --version 8.0.2

下边是打开abp suite创建的解决方案之后,需要用到的命令

5、清空nuget的http缓存

当推送了nuget的包去Nexus或者ProGet服务器后,Visual Studio却始终找不到最新的包?执行下属命令,再重新生成解决方案,可能就能解决问题。

命令是:

dotnet nuget locals http-cache -c

执行效果:

PS X:\brain\ziping> dotnet nuget locals http-cache -c
Clearing NuGet HTTP cache: C:\Users\David\AppData\Local\NuGet\v3-cacheLocal resources cleared.

6、abp install-libs

启动Blazor.Server.Host或者Web.Host等项目调试的时候,提示wwwroot/libs目录下缺失文件,导致web程序无法启动,就要在项目上点右键,选择“在终端中打开”。然后执行这条命令。

执行这条命令前需要做2件事情:

  1. 先要安装NPM。按照提示去下载和安装即可。
PS X:\brain\brain\host\Yee.Change.BrainModules.Blazor.Server.Host> abp install-libs
ABP CLI 7.2.1NPM is not installed, visit https://nodejs.org/en/download/ and install NPM

2)package.json的内容要正确。如何确保正确,用ABP Suite创建一个解决方案,去对应项目的根目录下拷贝这个文件的内容来即可。

3)删除yarn.lock为了不偏离本文的主旨,对这个命令另外撰文再详细截图。

6.1 Install via npm

It is recommended to install Yarn through the npm package manager, which comes bundled with Node.js when you install it on your system.

Once you have npm installed you can run the following both to install and upgrade Yarn:

在Visual Studio的终端中执行:

npm install --global yarn

7、dotnet ef

  • 安装最新版本
dotnet tool install -g dotnet-ef
  • 更新到最新版本
dotnet tool update -g dotnet-ef
  • 卸载当前版本
dotnet tool uninstall -g dotnet-ef

8、创建数据库

比如要启动Web.Host项目,数据库得先准备好。需要下边两条命令

  • 首先要有创建数据库的准备工作
dotnet ef migrations add Init
  • 如果add后要撤销, 就执行remove。
    remove后不需要参数。
dotnet ef migrations remove
  • 把上述改动提交到数据库服务器执行
dotnet ef database update

9、Windows文件路径的字符数最大长度限制

Microsoft官网文章

修改注册表的值
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem]
"LongPathsEnabled"=dword:00000001

其实用PowerShell最方便:

New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force

10、待续

posted on   终南山人  阅读(235)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
点击右上角即可分享
微信分享提示