The name ‘DisplayModes’ does not exist in the current context

The name ‘DisplayModes’ does not exist in the current context

The error above is caused from the following code:

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    DisplayModes.RequireConsistentDisplayMode = true;
}

Solution:

Replace

DisplayModes.RequireConsistentDisplayMode = true;

with

DisplayModeProvider.Instance.RequireConsistentDisplayMode = true;

Did my solution solve your problem? Leave a reply.

Visual Studio – “The type or namespace name ‘DataContractJsonSerializer’ does not exist in the namespace ‘System.Runtime.Serialization.Json’ (are you missing an assembly reference?)”

The type or namespace name ‘DataContractJsonSerializer’ does not exist in the namespace ‘System.Runtime.Serialization.Json’ (are you missing an assembly reference?)

in Italian:

Il tipo o il nome dello spazio dei nomi ‘DataContractJsonSerializer’ non esiste nello spazio dei nomi ‘System.Runtime.Serialization.Json’; probabilmente manca un riferimento a un assembly

Solution:

Add the following References to your project:

System.Runtime.Serialization
System.ServiceModel.Web

In Solution Explorer, right-click on the project node and click Add Reference to select the dll files.
Remember to add using or Imports lines inside your file.

Did my solution solve your problem? Leave a reply.

Visual Studio – “The type or namespace name ‘DataContractAttribute’ does not exist in the namespace ‘System.Runtime.Serialization’ (are you missing an assembly reference?)”

The type or namespace name ‘DataContractAttribute’ does not exist in the namespace ‘System.Runtime.Serialization’ (are you missing an assembly reference?)

in Italian:

Il tipo o il nome dello spazio dei nomi ‘DataContractAttribute’ non esiste nello spazio dei nomi ‘System.Runtime.Serialization’; probabilmente manca un riferimento a un assembly

Solution:

Add the following References to your project:

System.Runtime.Serialization
System.ServiceModel.Web

In Solution Explorer, right-click on the project node and click Add Reference to select the dll files.
Remember to add using or Imports lines inside your file.

Did my solution solve your problem? Leave a reply.

Silverlight for Windows Phone Project Template missing

Windows Phone SDK 7.1 automatically installs Microsoft Visual Studio 2010 Express edition.
If you have installed another edition of Microsoft Visual Studio 2010 you can also use this to create Windows Phone Projects.
Microsoft Visual Studio 2010 Express edition and the other editions are stored in the same Program Files folder “Microsoft Visual Studio 10.0”.

Cause:

Silverlight for Windows Phone Project Template is installed but in another language so when you try to create a new Project with the other Microsoft Visual Studio 2010 edition (NOT EXPRESS) the Silverlight for Windows Phone value into the Installed Templates list is missing.

Solution 1:

Uninstall Windows Phone SDK and reinstall it in the same language of the other Microsoft Visual Studio 2010 edition.

Solution 2 (UNDER THE HOOD):

Follow these Steps:

  1. Understand Microsoft Locale ID Values, it’s a table with correspondence between Language and Local ID.
  2. Store the Local ID value of your other Microsoft Visual Studio 2010 (NOT EXPRESS) editions languages.
  3. Go under <Visual Studio Install Path>\\Common7\\IDE\\ProjectTemplates\\<Language>\\Silverlight for Windows Phone\\
    for example:

    C:\\Program Files\\Microsoft Visual Studio 10.0\\Common7\\IDE\\ProjectTemplates\\CSharp\\Silverlight for Windows Phone
    
  4. Copy and paste the folder inside “Silverlight for Windows Phone” (for example: “1033”) and rename it with the other Local ID (stored at the Step 2).
  5. Repeat Steps 3-4 for each language you’ll use.
  6. Close all Microsoft Visual Studio 2010 running instances.
  7. Run a Command Prompt Window “as Administrator” and enter the following command (devenv is located in <Visual Studio Install Path>\\Common7\\IDE\\):
    devenv /InstallVSTemplates

    this operation, that registers the installed templates, may take several minutes.

Now you can create your Windows Phone Project with all your Microsoft Visual Studio 2010 editions.

NOTE:
If my solutions not work you can try to run the following command:

devenv /ResetSkipPkgs

that clears all SkipLoading tags added to VSPackages.

References:
Devenv Command Line Switches

Did my solution solve your problem? Leave a reply.

Visual Studio – “The type or namespace name ‘Json’ does not exist in the namespace ‘System.Runtime.Serialization’ (are you missing an assembly reference?)”

The type or namespace name ‘Json’ does not exist in the namespace ‘System.Runtime.Serialization’ (are you missing an assembly reference?)

in Italian:

Il tipo o il nome dello spazio dei nomi ‘Json’ non esiste nello spazio dei nomi ‘System.Runtime.Serialization’; probabilmente manca un riferimento a un assembly

Solution:

Add the following References to your project:

System.Runtime.Serialization
System.ServiceModel.Web

In Solution Explorer, right-click on the project node and click Add Reference to select the dll files.
Remember to add using or Imports lines inside your file.

Did my solution solve your problem? Leave a reply.