404 with static content in Razor Class Library (RCL)

后端 未结 4 493
渐次进展
渐次进展 2021-01-03 16:31

I am having difficulties implementing static files in razor class library (.net Core 3.1) that are consumed by an ASP.NET Core (v3.1) application.

When trying to acc

4条回答
  •  悲哀的现实
    2021-01-03 17:35

    If you remove the reference to Microsoft.AspNet.Core from the RclDemo.Library project, then everything works as expected. This is the line that should be removed from the project file:

    
    

    If you create a new .NET Core 3.x application, you would not include this reference as it is now included as part of the Microsoft.AspNetCore.App framework reference. Static files worked differently in .NET Core 2.2 Razor Class Libraries, and I think your inclusion of the Microsoft.AspNetCore.Mvc v2.2.0 library is breaking things. There used to be additional configuration to include static files in an RCL.

    Shawn

提交回复
热议问题