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

Add references to UWP dlls and winmd manually to access APIs

  • 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.

  • Download Restoro PC Repair Tool that comes with Patented Technologies (patent available here).

  • Click Start Scan to find Windows issues that could be causing PC problems.

  • Click Repair All to fix issues affecting your computer’s security and performance

  • Restoro has been downloaded by 0 readers this month.

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

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

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.

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 Windows.storage.dll 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

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

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.

If the advices above haven’t solved your issue, your PC may experience deeper Windows problems. We recommend downloading this PC Repair tool (rated Great on TrustPilot.com) to easily address them. After installation, simply click the Start Scan button and then press on Repair All.

Still having issues? Fix them with this tool:

SPONSORED

  • visual studioWindows 11WIndows UWP

Email *

Commenting as . Not you?

Comment