Friday, March 29, 2024
HomeWINDOWSWindows.Storage Namespace not found

Windows.Storage Namespace not found [Fixed]

-


If you use Visual Studio on your Windows 11 or Windows 10 computer, while working on a portable library class project you may get an error prompt stating Windows.Storage Namespace not found. In this post, we provide the most applicable fixes to this error.

Windows.Storage Namespace not found

For beginners, Windows.Storage namespace is a collection of Windows APIs that offers classes for managing files, folders, and application settings and should be noted that the System.Windows.Storage is not the same. 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). That said, you may encounter the error at hand due to the following reasons.

  • A particular DLL file is missing from your system.
  • A wrong variable declaration.
  • You are using the object browser incorrectly.
  • You have not included the reference to the proper package.

Windows.Storage Namespace not found

If you get Windows.Storage Namespace not found error prompt while working on a portable library class project in Visual Studio on your Windows 11/10 computer, then the suggested fixes presented below should help you resolve the issue on your system.

  1. Declare the variable globally in your code
  2. Use the Visual Studio Object Browser correctly
  3. Manually add the System.Runtime.WindowsRuntime.dll file to your project

Let’s quickly take a look at the description of these fixes. Before you proceed, to rule out the possibility of a missing DLL file, you can re-register all DLL files on your system. If you can identify the missing DLL file (in this case System.Runtime.WindowsRuntime.dll), provided it’s native to the Windows OS, you can head over to Winbindex and download a fresh copy of the file and place it exactly in the same folder as the original.

1] Declare the variable globally in your code

This is a common mistake programmers often commit or most likely hindsight. In the case of Windows.Storage Namespace not found error you may encounter in Visual Studio on PC; you have to declare the variable Windows.Storage.ApplicationData as a global variable on your computer. To do this, include the line below in your code and run all the tests with the build.

global::Windows.Storage.ApplicationData

If the error is still triggered, then you may use the global object browser as described in the next fix.

2] Use the Visual Studio Object Browser correctly

Use the Visual Studio Object Browser correctly

By default, the object browser is set to All Components, so you need to make sure you’re using the object browser correctly. Do the following:

  • Load up the build in Visual Studio.
  • Next, click on View from the menu tab.
  • Select Object browser from the menu. Alternatively, you can press the Ctrl+Alt+J key combo.
  • Next, set the Browse to All Components from the drop-down list.
  • Now, from the extensive list of components loads up, select the desired Component.
  • Next, tap on the Add to References in Selected Project icon in the Object browser to add it to the code.
  • Repeat the steps above to easily add any other reference object you want to the project library.

3] Manually add the System.Runtime.WindowsRuntime.dll file to your project

Manually add the System.Runtime.WindowsRuntime.dll file to your project

The error in view could be triggered if you have not added the reference to the proper package. In this case, to resolve the issue, you can manually add the System.Runtime.WindowsRuntime.dll file to your project by following these steps:

  • Open Visual Studio.
  • Go to Solution Explorer.
  • Next, right-click on References.
  • Select Add Reference from the context menu.
  • On the left side of the Reference Manager, click on the Browse tab.
  • Next, click the Browse button on the right of the window and navigate to the directory path below:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5
  • At the location, select All files from the drop-down list.
  • Now, find and select the System.Runtime.WindowsRuntime.dll file.
  • Finally, click the Add button to add the DLL file to your project.

That’s it!

Now read: IntelliSense not working in VS Code

What does Windows Storage DLL do?

The Windows.Storage DLL file, also known as Microsoft WinRT Storage API, is commonly associated with the Microsoft Windows Operating System. It is an essential component, which ensures that Windows programs operate properly. Essentially, DLL files are necessary to launch a program although they are not used frequently as editorial files. In any case, if the DLL file is corrupted or missing from your system, you could receive a DLL file missing error message.

How do I use Windows Storage?

In Windows 11/10 if configured or set up, Storage Spaces typically store two copies of your data so if one of your drives fails, you still have an intact copy of your data. So, you can use Storage Spaces to group two or more drives together in a storage pool and then use capacity from that pool to create virtual drives called storage spaces.



Source link

www.thewindowsclub.com

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular