How to Fix Windows.Storage Namespace Not Found Error

Add references to UWP dlls and winmd manually to access APIs

Reading time icon 4 min. read

Readers help support Windows Report. When you make a purchase using links on our site, we may earn an affiliate commission. Tooltip Icon

Read the affiliate disclosure page to find out how can you help Windows Report effortlessly and without spending any money. Read more

Key notes

  • While using Visual Studio for a portable class library project, many users may face an issue where the Windows.Storage namespace is not found. 
  • The issue seems to arise mostly due to an error on your end. For example, if you are not using the object browser correctly, or if you've not understood the error message. 
  • The trick lies in whether you are able to access the Windows APIs from WPF (Windows Presentation Foundation) and that's what the post focuses on. namespace

When trying to build a UWP app you may sometimes realize that the Windows.Storage namespace is not found.

On a closer look, this issue arises mostly due to an error on your end, and that’s what we will discuss in further sections. But, if the UWP apps lag & stutter on your Windows 11 PC, you can refer to our post for some effective solutions.

What is Windows.Storage namespace?

Windows.Storage namespace is a collection of Windows APIs that offers classes for managing files, folders, and application settings.

The Microsoft official web page also explains how to use the objects in Windows.Storage namespace.

Why is Windows.Storage namespace not found?

Sometimes, while using Visual Studio you may encounter an issue like Windows.Storage namespace not available or not found. This could be due to any of the following reasons:

  • If you are using the object browser incorrectly The object browser is by default set to All Components which needs to be changed to what you have.
  • You have not included the reference to the proper package – You won’t get access to the Windows.Storage namespace, unless you add the references to the correct package.

Note that the System.Windows.Storage is not the same as Windows.Storage. If the error message reads System.Windows.Storage (part of .NET & the root namespace for WPF), it’s different from Windows.Storage (root namespace for WinRT, the primary API for UWP apps).

How can I fix Windows.Storage Namespace Not Found error?

1. Add the references to UWP DLLs and WINMD files manually

  1. When using Visual Studio, go to Solution Explorer, right-click on References, and select Add Reference from the context menu. add reference
  2. On the left side of the Reference Manager, click on Browse and navigate to the following path: C:Program Files (x86)Windows Kits10UnionMetadatawinmdbrowse to path
  3. Now, add it to your project as a reference. Also, make sure to change the filter to All Files.
  4. Again, right-click on References, and click on Add Reference from the context menu. add reference
  5. Next, on the left of the Reference Manager, go to Browse and find the directory, C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETCorev4.5.browse to path
  6. Add System.Runtime.WindowsRuntime.dll to your project.add System.Runtime.WindowsRuntime.dll

So, if you are unable to access Windows.Storage namespace, it could be possible that you have not added the reference to the proper package.

Note icon NOTE
Here you can find the SDK.

In this situation, you may feel that Windows.Storage namespace is not found. You would need to download the package following the above steps.

You can now build your own WPF application location-aware by calling on the Geolocator class in Windows.Devices.Geolocation API.

At the same time, you can also use the asynchronous pattern in UWP. This is because the classes and methods you usually consider as UWP code is now incorporated with classes and methods from WPF.

But, if the crashes on your Windows PC, we recommend a list of solutions that may help you fix the issue quickly.

2. Use the object browser correctly

  1. By default, the object browser is set to All Components, hence, firstly, select NET Portable Subset (Visual Studio 2013). all components
  2. Next, to add the Windows.Storage, select All Components, and look for Windows.winmd. search Windows.winmd
  3. Now, Highlight the desired Component, and click on Add to References in Selected Project under Solution Explorerreference added

This will add the reference to the Portable Library project, and you can now use your StorageFolder in Class1.cs.

Alternatively, if you do not want to install the Windows Store at this moment, but simply want to use some of those Windows APIs, you can get them from your app. How?

Nevertheless, you can achieve this by using a NuGet package, also called as UwpDesktop. To inspect the source code, you can visit GitHub.

If you have any other queries related to a missing Windows API, let us know in the comments section below.

More about the topics: visual studio, Windows 11