Embedding View files as resource inside Binary

前端 未结 5 1131
不知归路
不知归路 2021-02-06 09:36

I am trying to create a .Net Library with few Controllers, and i want to reuse them in Multiple web projects.

I\'m half way through, But problem i\'m getting is , Whenev

5条回答
  •  生来不讨喜
    2021-02-06 09:57

    Check out the ASP.NET MVC View Engine using VB.NET XML Literals project on CodePlex http://vbmvc.codeplex.com

    It is a custom view engine originally conceived of by Dmitry Robsman, who is a PUM for ASP.NET at Microsoft. Each view is a VB.NET class and the Namespace (instead of file path) is used to connect Views to Controllers. It's fairly straight forward to copy the content of your ASPX view files into the XML literals in these VB classes. And as classes, they are compiled into the assembly without any extra effort.

    If your controllers are C#, then most likely you'd end up with 2 DLLs, but Scott Hanselman has a blog post on getting C# and VB to live together in the same assembly. http://www.hanselman.com/blog/MixingLanguagesInASingleAssemblyInVisualStudioSeamlesslyWithILMergeAndMSBuild.aspx

提交回复
热议问题