开发者

SharePoint project not able to find the getter and setter methods of a static property

I have a Class Library project having a class with a property:

 public class MyClass
    {

     public static string MyProperty
            {
                get;
                set;
            }   
}

And a SharePoint 2010 Project with a reference to class library project having a Application page:

public partial class MyPage : LayoutsPageBase
    {

     protected void Page_Load(object sender, EventArgs e)
            {

    MyNamespace.MyClass.MyProperty = "ABC";
    }
}

The above code is giving me an exception I'm totally not able to guess why.

Exception:

Method not found: 'Void MyNamespace.MyClass.set_MyProperty(System.String)'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for开发者_运维技巧 more information about the error and where it originated in the code.

Exception Details: System.MissingMethodException: Method not found: 'Void MyNamespace.MyClass.set_MyProperty(System.String)'.

Any direction to what am I doing wrong here?


It seems likely that you have a version of the class library installed that does not have the "MyProperty" member. Have a look in the GAC and Bin to make sure that only the current version of your DLL is installed.

Make sure you've recycled the app pools, timer service and anything else that might have a cached version in memory.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜