VS2022升级导致的EF CodeGeneration错误处理

在升级VS2022后,一个Net6的aspNetCore项目在创建View并使用CodeGeneration时出现错误,提示缺少Microsoft.EntityFrameworkCore的特定版本。发现项目中EF的版本为6.0.8,而错误提示需要6.0.12。尽管EF已有7.0.2版本,但作者选择将相关包升级至6.0.12来解决问题,升级后恢复正常。

VS2022又发布更新了,升级完成后,原来的Net6的aspNetCore项目,创建View时,使用CodeGeneration时,提示如下的错误:

......
Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=6.0.12.0, Culture=neutral, 
...

进入项目的依赖,看一下EF相关的包,是6.0.8版本的,初看看这样子的一个小的版本升级,都能导致了一些问题。而随着Net7的发布,EF已经都7.0.2版本了。

按照提示,把对应的包升级到6.0.12,也不敢升级到最新的。

版本不同及升级选择

按照错误提示,主要选择这几个包进行升级。
升级完成,操作就正常了。

PS C:\Users\ymc> pip install gensim Collecting gensim Downloading gensim-4.3.3.tar.gz (23.3 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23.3/23.3 MB 48.1 kB/s 0:09:23 Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/numpy/ Collecting numpy<2.0,>=1.18.5 (from gensim) WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/65/6e/09db70a523a96d25e115e71cc56a6f9031e7b8cd166c1ac8438307c14058/numpy-1.26.4.tar.gz Downloading numpy-1.26.4.tar.gz (15.8 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 15.8/15.8 MB 48.2 kB/s 0:05:14 Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... error error: subprocess-exited-with-error × Preparing metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [21 lines of output] + C:\Users\ymc\AppData\Local\Programs\Python\Python313\python.exe C:\Users\ymc\AppData\Local\Temp\pip-install-hvjqgd9r\numpy_8ef893f268094eedaeef4de9ba2c9166\vendored-meson\meson\meson.py setup C:\Users\ymc\AppData\Local\Temp\pip-install-hvjqgd9r\numpy_8ef893f268094eedaeef4de9ba2c9166 C:\Users\ymc\AppData\Local\Temp\pip-install-hvjqgd9r\numpy_8ef893f268094eedaeef4de9ba2c9166\.mesonpy-54jz0dpl -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=C:\Users\ymc\AppData\Local\Temp\pip-install-hvjqgd9r\numpy_8ef893f268094eedaeef4de9ba2c9166\.mesonpy-54jz0dpl\meson-python-native-file.ini The Meson build system Version: 1.2.99 Source dir: C:\Users\ymc\AppData\Local\Temp\pip-install-hvjqgd9r\numpy_8ef893f268094eedaeef4de9ba2c9166 Build dir: C:\Users\ymc\AppData\Local\Temp\pip-install-hvjqgd9r\numpy_8ef893f268094eedaeef4de9ba2c9166\.mesonpy-54jz0dpl Build type: native build Project name: NumPy Project version: 1.26.4 WARNING: Failed to activate VS environment: Could not find C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe ..\meson.build:1:0: ERROR: Unknown compiler(s): [['icl'], ['cl'], ['cc'], ['gcc'], ['clang'], ['clang-cl'], ['pgcc']] The following exception(s) were encountered: Running `icl ""` gave "[WinError 2] 系统找不到指定的文件。" Running `cl /?` gave "[WinError 2] 系统找不到指定的文件。" Running `cc --version` gave "[WinError 2] 系统找不到指定的文件。" Running `gcc --version` gave "[WinError 2] 系统找不到指定的文件。" Running `clang --version` gave "[WinError 2] 系统找不到指定的文件。" Running `pgcc --version` gave "[WinError 2] 系统找不到指定的文件。" A full log can be found at C:\Users\ymc\AppData\Local\Temp\pip-install-hvjqgd9r\numpy_8ef893f268094eedaeef4de9ba2c9166\.mesonpy-54jz0dpl\meson-logs\meson-log.txt [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. hint: See above for details.
09-24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值