Visual Studio users, mainly those who are working on a portable library class project have raised this “Windows. Storage Namespace not found” error prompt they have received in the Studio. This problem seems to be due to the absence of a particular dll file on your system. In some cases, the same issue can surface in case of a wrong variable declaration. So, without wasting your time jump into the main solution and fix the problem yourself.
Fix 1 – Add Windows Runtime DLL to the project
You have to add a reference to the Runtime.WindowsRuntime.dll file and test.
1. Open the project in Visual Studio, if it isn’t opened already.
2. Then, click on “View” on the menu bar and tap “Solution Explorer” to open the Solution Explorer in VS.
3. On the Solution Explorer page, right-click on the “References” tab and tap “Add Reference…” to access that.
4. Now, in the Reference Manager window, go to the “Browse” tab.
5. Then, tap “Browse…” to browse to the DLL file.
6. Next go to this location –
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1
7. Look for the DLL file. Select “All files” from the drop-down list.
8. Select the “System.Runtime.WindowsRuntime.dll” dll file.
9. Then, tap “Add” to add the dll file to your project.
Once you have added the DLL file, try to test the build on your computer. The problem won’t appear again.
Fix 2 – Declare the variable globally
This is another common mistake programmers often commit. You have to declare the variable Windows.Storage.ApplicationData as a global variable on your computer.
So, just include this in your code –
global::Windows.Storage.ApplicationData
Then, run all the tests with the build. If the error still persists, you may use the global object browser following the next fix.
Fix 3 – Use the object browser
There is another tool you can use to identify the object browser.
1. Load up the build in Visual Studio.
2. Then, click on “View” from the menu tab and choose “Object browser” to open that.
You can also use the Ctrl+Alt+J keys together.
3. Now, set the “Browse” to “All Components” from the drop-down list.
An extensive list of components will load up.
4. Carefully, select the “System.Runtime.WindowsRuntime.dll“.
4. Next, tap on the “Add to References in Selected Project” icon in the Object browser to add it to the code.
This way, you can easily add the reference object to the project library.