How to fix "error CS1061" ? RRS feed

  • Question

  • Hi Everyone,

    I have an error message when I try to run my program, this is error CS1061 like show below. But actually my program is success full to run before.. But I don't know why suddenly when I try to compile there's any error :  

    Startup.cs(59,22): error CS1061: 'IServiceCollection' does not contain a definition for 'AddDistributedSqlServerCache' and no extension method 'AddDistributedSqlServerCache' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?) [C:\btn\app\app.csproj]

    • Moved by CoolDadTx Monday, April 16, 2018 2:29 PM ASP.NET related
    Monday, April 16, 2018 7:11 AM

All replies

  • Hi Yuda,

    >>error CS1061

    From MSDN, this error occurs when you try to call a method or access a class member that does not exist.

    Please make sure 'IServiceCollection' has a member named 'AddDistributedSqlServerCache' in your definition, or you can provide the code related to this error.



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, April 16, 2018 9:28 AM
  • What you are talking about is only available on ASP.NET Core. Your app needs to compiling for that (not ASP.NET) and then the extension method will be available. Please post questions related to ASP.NET Core in the ASP.NET forums.

    Michael Taylor http://www.michaeltaylorp3.net

    Monday, April 16, 2018 2:29 PM