Unable to find the path to the view.cshtml file in the Razor Class Library(The Razor Class Library is .dll)

我的梦境 提交于 2019-12-11 15:42:26

问题


I'm currently working on an demo application of ASP.NET Core 2.1. I try to use the new RCL(Razor class Library) in my ASP.NET Core MVC application.

I have 2 projects in my Solution

  1. Project 1 : ASP.NET Core MVC application
  2. Project 2 : Razor Class Library(MVC)

The structure of my Razor Class Library is very simple:

  • Areas
    • MyFeature
      • Views
        • Shared
          • _Layout.cshtml

↓ This is the source code of _ViewStart.cshtml in the project 1 ( ASP.NET Core MVC application)

@{
     Layout = "/Areas/MyFeature/Views/Shared/_Layout.cshtml";
}

Steps to reproduce the issue :

  1. Build Razor Class Library(MVC)
  2. within Project 1( ASP.NET CORE MVC application) , add reference to .dll, view.dll generated by step 1 , .
  3. Excludes dependencies on Project 2 (RCL).
  4. Within Visual Studio , unload the Project 2 (RCL).
  5. Build Project 1 (ASP.NET CORE MVC application).
  6. The results are shown below.

Why do such errors occur?

I've upload my Project file on Google Drive (DownLoad Link)

I want to encrypt files in Razor Class Library(MVC) .

Please tell me if my method is wrong or the steps are wrong.

I'll be looking forward to reply.

来源:https://stackoverflow.com/questions/52732801/unable-to-find-the-path-to-the-view-cshtml-file-in-the-razor-class-librarythe-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!