How to resolve error CS1061?

Cindy See 166 Reputation points

I have a data access layer and business object layer in my ASP.Net web application.
Everytime when I made changes to the existing function or added a new function in the data access layer and business object layer, it will throw error CS1061 when I build the solution. I think it is because the metadata of these files in the layer are locked and not reflecting the latest changes. How can I resolve or avoid this issue?

A set of technologies in the .NET Framework for building web applications and XML web services.
3,778 questions
A Microsoft web application framework that implements the model-view-controller (MVC) design pattern.
1,059 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,490 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
884 questions
0 comments No comments
{count} votes

Accepted answer
  1. Lan Huang-MSFT 19,911 Reputation points Microsoft Vendor

    Hi @Cindy See ,
    The CS1061 error is caused when you try to call a method or access a class member that does not exist.
    The following example generates CS1061 because Person does not have a DisplayName method. It does have a method that is called WriteName. Perhaps that is what the author of this source code meant to write.

    public class Person  
        private string _name;  
        public Person(string name) => _name = name;  
        // Person has one method, called WriteName.  
        public void WriteName()  
    public class Program  
        public static void Main()  
            var p = new Person("PersonName");  
            // The following call fails because Person does not have  
            // a method called DisplayName.  
            p.DisplayName(); // CS1061  

    To correct this error

    1. Make sure you typed the member name correctly.
    2. If you have access to modify this class, you can add the missing member and implement it.
    3. If you don't have access to modify this class, you can add an extension method.

    When asking a question, you'd better provide a minimal reproducible example. so that we can better help you solve the problem.

    Best regards,
    Lan Huang

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

0 additional answers

Sort by: Most helpful