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

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

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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,也不敢升级到最新的。

版本不同及升级选择

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

Preparing metadata (pyproject.toml) ... done Discarding https://files.pythonhosted.org/packages/03/c1/20fc2c50ab1e3304da36d866042a1905a2b05a1431ece35448ab6b4578f2/pyradiomics-3.1.0.tar.gz (from https://pypi.org/simple/pyradiomics/): Requested pyradiomics from https://files.pythonhosted.org/packages/03/c1/20fc2c50ab1e3304da36d866042a1905a2b05a1431ece35448ab6b4578f2/pyradiomics-3.1.0.tar.gz has inconsistent version: expected '3.1.0', but metadata has '3.0.1a1' Using cached pyradiomics-3.0.1.tar.gz (34.5 MB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [30 lines of output] C:\Users\74347\AppData\Local\Temp\pip-install-86zdih1y\pyradiomics_2ef2f0989d364930b8fcf5af70c60eba\setup.py:9: SetuptoolsDeprecationWarning: The test command is disabled and references to it are deprecated. !! ******************************************************************************** Please remove any references to `setuptools.command.test` in all supported versions of the affected package. This deprecation is overdue, please update your project and remove deprecated calls to avoid build errors in the future. ******************************************************************************** !! from setuptools.command.test import test as TestCommand C:\Users\74347\AppData\Local\Temp\pip-install-86zdih1y\pyradiomics_2ef2f0989d364930b8fcf5af70c60eba\versioneer.py:418: SyntaxWarning: invalid escape sequence '\s' LONG_VERSION_PY['git'] = ''' Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "C:\Users\74347\AppData\Local\Temp\pip-install-86zdih1y\pyradiomics_2ef2f0989d364930b8fcf5af70c60eba\setup.py", line 79, in <module> version=versioneer.get_version(), ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\74347\AppData\Local\Temp\pip-install-86zdih1y\pyradiomics_2ef2f0989d364930b8fcf5af70c60eba\versioneer.py", line 1476, in get_version return get_versions()["version"] ^^^^^^^^^^^^^^ File "C:\Users\74347\AppData\Local\Temp\pip-install-86zdih1y\pyradiomics_2ef2f0989d364930b8fcf5af70c60eba\versioneer.py", line 1408, in get_versions cfg = get_config_from_root(root) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\74347\AppData\Local\Temp\pip-install-86zdih1y\pyradiomics_2ef2f0989d364930b8fcf5af70c60eba\versioneer.py", line 342, in get_config_from_root parser = configparser.SafeConfigParser() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'? [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. (E:\python) C:\Users\74347>什么意思
03-28
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值