Sharing Razor views across projects
问题 I want to share the layout (Header, Navigation and Footer Razor views) across multiple ASP.NET MVC projects. How can I do that? Can I create a custom NuGet package to wrap the common Razor files, images and CSS? 回答1: Three approaches: Share the Razor view source code using your version control system Compile the views into a separate DLL file for binary sharing. Create a NuGet package See Compile your ASP.NET MVC Razor views into a separate DLL for how you do option 2. For option 3, see