Is it possible to use Razor as a standalone library (without any asp.net business) on OSX (via Mono)

非 Y 不嫁゛ 提交于 2019-12-22 08:31:48

问题


I would like to write a proof of concept MonoMac app which renders html "Views" using c# and Razor.

Is this possible?

If not, does anyone recommend any other Templating engines that compare to the simplicity of Razor. I don't mind writing it in Objective-C if I have to, but Mono would be simpler.


回答1:


I think you may be interested in this project. You just have to download zip which consists of two DLLs, reference them in your project and examples like these just works. Have in mind that you have to make 4.0 project. I have been testing this on Mono 2.10.5, however OS was Linux, not OS X, because I don't have one. It shouldn't be a problem nevertheless.

Another approach is to do something like mentioned here. Post is quite old and libraries' names has changed but you should be able to use one which are downloadable here. The first approach is cleaner, however I am not sure if it is what you need.

You can also find this project interesting.



来源:https://stackoverflow.com/questions/7328641/is-it-possible-to-use-razor-as-a-standalone-library-without-any-asp-net-busines

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