locked
RazorPageAttribute is Obsolete RRS feed

  • Question

  • User2012297617 posted

    I got a project that builds fine with no errors. However, I’m trying to resolve the warning errors. Here’s an example of one of the errors:

    CS0618 - RazorPageAttribute is obsolete: This attribute has been superseded by RazorCompiledItem and will not be used by the runtime.

    The error is related to the following line of code:


    [assembly: Global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@”/Pages/About.cshtml”, typeof(MyProject.Pages.Pages_About), null)]


    I tried removing the packages with version 2.2.0.  For example, Microsoft.AspNetCore(2.2.0), but no luck. Also, the Frameworks in the project are the following:
    Microsoft.AspNetCore.App
    Microsoft.NETCore.App


    Is there any way to change the Assembly:Global listed above to something else?  Any recommendation is greatly appreciated.

    Saturday, May 22, 2021 11:58 PM

Answers

  • User-474980206 posted

    You must have some unsupported nuget or project references in you upgraded project. Show your project file.

    also did you do a clean first?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 23, 2021 3:54 PM

All replies

  • User-474980206 posted

    You must have some unsupported nuget or project references in you upgraded project. Show your project file.

    also did you do a clean first?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 23, 2021 3:54 PM
  • User2012297617 posted

    Yes, I did some cleanup, restored some of the nuget packages, I suppressed some of the errors in the project properties.  I got it down to 0 warnings. I will continue testing the project. I'll open a new question if I need additional help  Thank you!

    Sunday, May 23, 2021 4:56 PM