Type or namespace name "dynamic" not found

Microsoft Visual Studio 2010 Ultimate (version 10.0.40219.1 SP1Rel).

Microsoft.NET Framework version 4.5.50709 SP1Rel

I am compiling in .net framework 4.0.

Whenever I try to use dynamic or var data types, I get the error shown in the subject line:

Unable to find the type or namespace name 'dynamic'.

Unable to find type name or namespace "var".

I am trying to use JsonFX to parse the data that I get from another web service. Sometimes the data will be a β€œmessage”, and sometimes it will be a β€œtrack”. According to this JsonFx Documentation , I have to follow the example for "Serialize to / from dynamic types (default for .NET 4.0):"

I added a page to my site called test. The code block below is Test.aspx.cs The code I'm trying to use is as follows:

using System;
using System.Text;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using JsonFx;
using JsonFx.Json;
using Microsoft.CSharp;

public partial class Test : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string Data = "";
        Data = @"[{""meta"":{""account"":""orbitinte"",""event"":""track""},""payload"":{""id"":410827200397312213,""id_str"":""410827200397312213"",""asset"":""359551031717134"",""recorded_at"":""2013-02-07T15:59:04Z"",""received_at"":""2013-02-07T16:00:37Z"",""fields"":{}}},{""meta"":{""account"":""orbitinte"",""event"":""track""},""payload"":{""id"":410827200409895125,""id_str"":""410827200409895125"",""asset"":""359551031717134"",""recorded_at"":""2013-02-07T16:00:04Z"",""received_at"":""2013-02-07T16:00:37Z"",""fields"":{}}}]";
        Data = @"[{""meta"":{""account"":""orbitinte"",""event"":""message""},""payload"":{""id"":410865901198377173,""thread_id"":null,""parent_id"":410865891354345685,""id_str"":""410865901198377173"",""thread_id_str"":"""",""parent_id_str"":""410865891354345685"",""type"":""message"",""channel"":""com.mdi.services.adminProtocol"",""sender"":""359551031717134"",""recipient"":""@@server@@"",""asset"":""359551031717134"",""b64_payload"":""eyJlcnJvciI6ImNhbm5vdCBwYXJzZSBjb21tYW5kIn0="",""recorded_at"":""2013-02-07T18:34:25Z"",""received_at"":""2013-02-07T18:34:24Z""}}]";


        JsonReader Reader = new JsonReader();
        dynamic Output = Reader.Read(Data);

        Notifications oNotifications = new Notifications();
        oNotifications.ProcessNotifications(Data);
    }
}

In the web.config file:

  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <providerOption name="CompilerVersion" value="v4.0"/>
        <providerOption name="WarnAsError" value="false"/>
      </compiler>
    </compilers>
  </system.codedom>

I am new to C # and asp.net. But I was looking for a solution to this problem for a while. Everything I see mentions the compiler version and the .net framework version. I think I have provided all the relevant data, but if there is anything else I should add to this question, please let me know.

+5
2

IIS .NET 2.0? , . . ?

:

<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

Version = 2.0.0.0

+4

, Microsoft.CSharp .

DLL .

+5

All Articles