Entity Framework缺失注册表值求助:VS2017安装EF包报错
Fixing EF Package Installation Error in Visual Studio 2017 via Registry Edits
Hey there, I’ve walked through this exact issue with other developers using VS2017 and EF package installs. Let’s break down the registry-based fixes first, plus some extra steps to cover all bases.
First: Critical Pre-Step - Backup Your Registry
Before touching any registry keys, do this to avoid headaches:
- Press
Win + R, typeregedit, and hit Enter to open the Registry Editor. - Right-click on the top-level
Computernode and select Export. Save the file somewhere safe (like your desktop) so you can restore if anything goes wrong.
Registry Fixes to Try
1. Reset VS2017’s EF/NuGet Registry Entries
VS2017 stores user-specific config under versioned registry keys. Here’s how to clear corrupted entries related to EF:
- Navigate to
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\15.0_<your-VS-instance-id>(the instance ID is a random string like15.0_abc123). - Look for subkeys named
NuGetorEntityFramework. Right-click and delete these keys—they’ll automatically rebuild when you restart VS. - Restart Visual Studio and try installing the EF package again.
2. Verify .NET Framework Registry Entries
EF requires a compatible .NET Framework version, and sometimes these registry entries get messed up:
- Go to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full. - Check that the
InstallDWORD value is set to1(if not, double-click it and change the value data to 1). - Confirm the
Versionstring matches a supported version (EF 6+ needs .NET 4.7.2 or later—if yours is older, update .NET Framework first, then revisit this step).
3. Reset VS2017’s Global User Settings via Command
If the above doesn’t work, reset VS’s core registry-backed user data:
- Close all VS instances.
- Open Command Prompt as Administrator, then run this command:
devenv /resetuserdata - This will reset VS to default user settings, which often fixes registry-related glitches. Once done, restart VS and attempt the EF install again.
Bonus: Non-Registry Troubleshooting Steps
If registry edits don’t resolve the issue, these might help:
- Repair Visual Studio 2017: Open the Visual Studio Installer, select your VS2017 instance, click Modify > Repair.
- Clear NuGet cache: Go to
Tools > Options > NuGet Package Manager > Generaland click Clear All NuGet Cache(s).
内容的提问来源于stack exchange,提问作者Mohammad.Net
相关产品推荐
相关产品推荐

