2

I'm currently working on a project in which I need to work with registry keys. As read in several tutorials, the namespace Microsoft.Win32 offers a class called RegistryKey to work with the registry.

My problem is that Visual Studio can't find the class although I imported the namespace using using Microsoft.Win32;.

Normally I only type in just a few letters and I already get a suggestion for the class I'm searching for. But now Visual Studio doesn't even suggest the class.

Did I forget anything? Are there other namespaces I need to use? I'm using Visual Studio 2017 Enterprise - maybe it's because of that?

Pete Hilde
  • 617
  • 8
  • 22
  • `RegistryKey` class is in `Microsoft.Win32` namespace (`mscorlib` asembly) and should be visible. You could try with some asnwers from [this question](https://stackoverflow.com/questions/37015074/visual-studio-intellisense-not-showing-some-classes) – Nino Jul 04 '17 at 08:27

3 Answers3

2

I forgot to mention that I'm creating a .NET Core Application. As a result I had to download the required class using the NuGet Package Manager because .Net Core applications manage their references in NuGet packages!

Pete Hilde
  • 617
  • 8
  • 22
1

The registry is simply not part of .NET Core. Take a look at Windows Compatibility Pack https://docs.microsoft.com/en-US/dotnet/core/porting/windows-compat-pack

Stephen Kennedy
  • 18,869
  • 22
  • 90
  • 106
Polluks
  • 415
  • 1
  • 7
  • 17
0

You need to install the Microsoft.Win32.Registry Nuget Package.

Renan Araújo
  • 3,350
  • 11
  • 34
  • 47