我在Asp.Net 3.5应用程序中使用Facebook SDK C#Library.当我尝试编译下面的代码时,给我错误.据我所知在4.0框架中使用动态类型.所以无论如何要重写它以使它工作?我有一个System.Core 3.5的引用,但它仍然没有编译
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Params.AllKeys.Contains("signed_request"))
{
var result = FacebookSignedRequest.Parse(FacebookContext.Current.AppSecret, Request.Params["signed_request"]);
dynamic signedRequestValue = result.Data;
this.RegistrationData = signedRequestValue.registration;
}
else
{
Response.Redirect("~/");
}
}
protected dynamic RegistrationData { get; set; }
Error 1 Cannot define a class or member that utilizes 'dynamic' because the compiler required type 'System.Runtime.CompilerServices.DynamicAttribute' cannot be found. Are you missing a reference to System.Core.dll?
Error 2 Cannot define a class or member that utilizes 'dynamic' because the compiler required type 'System.Runtime.CompilerServices.DynamicAttribute' cannot be found. Are you missing a reference to System.Core.dll?
Run Code Online (Sandbox Code Playgroud)
我的项目已经> 4.0.事实上,它是4.5.2.我遇到了这个错误.我做了什么来解决它:
我将项目更改为4.5.1.
我把它改回4.5.2.
问题解决了!
谢谢 - 希望这有助于那里的人.
PS - 不使用Facebook SDK,但这可能会有所帮助.