Domanda

We are a .NET shop (usually ASP.NET MVC) and we have a customer requirement for a static HTML site. As we have gone through this exercise the thing the only part of it that has gotten under my skin is the massive duplication that in a dynamic site we have many tricks for avoiding. Does anyone know of any libraries that would facilitate me developing my code in Razor or something similar, using partial views, master pages or similar tools but then be able to generate the output as a static HTML site.

I know that I could create a system to do so, but I have no need to recreate the wheel if others have already created it.

P.S.: I am not really interested in debating whether my customer SHOULD want a static site.

È stato utile?

Soluzione

Sounds like you are looking for a template engine for Visual Studio.

I suggest looking at the built in one - T4.

In Visual Studio, a T4 text template is a mixture of text blocks and control logic that can generate a text file. The control logic is written as fragments of program code in Visual C# or Visual Basic. The generated file can be text of any kind, such as a Web page, or a resource file, or program source code in any language.

You can use this to create your static HTML files.


Alternatively, take a look at embedding Razor, as Rick Strahl describes.

Or even T4 with Razor as described by Mikael Söderström.

Altri suggerimenti

If you are looking for a general preprocessor/template engine, try PPWizard -- don't let the site scare you, its a nice tool.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top