简体   繁体   中英

StringDictionary type or namespace not found but the correct namespace is included

I'm trying to use StringDictionary in a Windows 8.1 app with the .NET 4.5 framework, however VS cannot find the StringDictionary class. According to the MSDN documentation, StringDictionary is in the System.Collections.Specialized namespace. I've made sure to include the correct namespace and it just won't build.

I saw that other people had similar issues because VS defaulted to the .NET 4.0 Client framework, and the issue was solved by changing the Target Platform to the full .NET 4.0 framework. Look at this question . But Windows 8.1 projects in VS 2013 doesn't give me the option to change the Target Platform and there isn't a difference in the frameworks in .NET 4.5.

So here are the steps to recreate the issue:

  1. Create new project in VS 2013
  2. Select C# Class Library (or any template) under the Windows Store template
  3. Create a simple test class file. I used the code from the examples on MSDN, found HERE

If anyone knows how to diagnose these issues as well that'd be very helpful. I found that you can troubleshoot assembly issues from the Visual Studio command line with the fuslogvw command, but it didn't help.

This class is just not available in WinRT (yes it have it's own .NET Framework). The MSDN page you link clearly specifies there is no .NET for Windows Store apps target support for that class. See difference with generic Dictionary class for example (scroll down to Version Information section).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM