Visual Studio 2022 ,.c源文件无法正常执行,报由于找不到ucrtbased.dll,无法继续执行代码。重新安装程序可能会解决此问题。
【解决方法:】
1.VS installer的修复功能:
这方法大概率没啥用。
2.下载最新的windows10 SDK:来源
This is important because the version of ucrtbased.dll that ends up being copied to System32 and SysWoW64 is from the latest installed Windows 10 SDK. This means that if you have two SDKs installed and the setup for the latest one failed somehow, then it is possible to not have these files in the locations that Windows would look in for executables.
因为最终被复制到System32和SysWoW64的ucrtbase.dll版本来自最新安装的Windows 10 SDK。这意味着,如果您安装了两个 SDK,并且最新版本的安装程序以某种方式失败,则可能无法在 Windows 查找可执行文件的位置没有这些文件。
但是实际操作中,我重新安装了最新的SDK之后也没有解决这个问题。该方法仅供参考。
3.下载ucrtbase.dll文件,并解压在对应目录下:
64位系统:C:\Windows\System32\
32位系统:C:\Windows\SysWOW64\
DLL-files.com网站下载链接(可下载32位和64位的文件)
百度网盘下载链接
链接:https://pan.baidu.com/s/1QjkFX9G6pPdbKn8C93l0Dw
提取码:gq6n
–来自百度网盘超级会员V3的分享(网盘链接中只有64位的文件)
4.补充,将windows 10 SDK中的ucrtbase.dll文件复制到相应的目录中也可以解决这个问题;(主要是博主有点嫌弃方法3中下载的ucrtbase.dll文件修改日期比较旧,修改日期在16年)
根据解决方法2查到的信息可知,原因在于VS安装的SDK中的文件没有成功复制到C:Windows\System32或者目录下,所以可以通过在SDK安装目录下查询ucrtbase.dll文件,并复制到平台对应的目录下来解决这个问题,博主亲测有效。
1. 使用搜索工具查找ucrtbase.dll文件,博主用的是Everything;
2. 这里根据X64、X86平台的不同,博主选择了这两个目录下的ucrtbase.dll;
3. 复制这两个文件,并分别放在对应的目录中;
4. 打开Vs重新编译,通过!!