How to fix CS0433 errors in ASP.NET 5?

A line of code that calls any place in it that refers to the type of System.Collections.Generic.Dictionaryboth the type of the variable and the declaration of use.

This usage declaration worked fine and made my classes less disgusting than writing System.Collections.Generic.Dictionary<string, object>in 100 places in my class. Displaying ads using does not solve my problem, it just moves it to the places where the dictionary type is used in my method parameters.

Full error text:

CS0433  The type 'Dictionary<TKey, TValue>' exists in both
'System.Collections, Version=4.0.10.0, Culture=neutral,
  PublicKeyToken=b03f5f7f11d50a3a' 
 and 
'mscorlib, Version=4.0.0.0, Culture=neutral, 
 PublicKeyToken=b77a5c561934e089'   ProjectName.DNX 

This error occurs in projects based on ASP.NET 5 MVC 6 templates using DNX 1.0.0-beta7, which have some Model and Controller classes that reference common collection types. The .json project is installed this way:

  "frameworks": {
    "dnx451": { }
  }

A sample problem arises if you just say:

  "frameworks": {
    "dotnet": { }
  }
  • , , - , , , 6 7.

  • , JsonDictionary, .

ASP.NET.

? , mscorlib System.Collections?

+4
2

- 6, , , "dotnet", - 7, :

"frameworks": {
    "dnx451": { },
    "dnxcore50": {
      "dependencies": {
        "Microsoft.CSharp": "4.0.1-beta-23225",
        "System.Collections": "4.0.11-beta-23225",
        "System.Linq": "4.0.1-beta-23225",
        "System.Runtime": "4.0.21-beta-23225",
        "System.Threading": "4.0.11-beta-23225"
      }
    }
  }

, json, .

+2

.

"frameworks": {
     "dnx451": {
      "frameworkAssemblies": {
         "System.Collections":  ""
       }
     }
}
+1

Source: https://habr.com/ru/post/1606624/


All Articles