<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>RazorGenerator Wiki Rss Feed</title><link>http://razorgenerator.codeplex.com/</link><description>RazorGenerator Wiki Rss Description</description><item><title>Updated Wiki: Home</title><link>https://razorgenerator.codeplex.com/wikipage?version=21</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;Razor Generator&lt;/h1&gt;
This is a Custom Tool for Visual Studio that allows processing Razor files at design time instead of runtime, allowing them to be built into an assembly for simpler reuse and distribution. &lt;br /&gt;&lt;br /&gt;Note that this tool currently only supports C#. VB support could probably be done if someone wants to help out with it!&lt;br /&gt;
&lt;h2&gt;Installation instructions&lt;/h2&gt;It’s on the VS extension gallery, so install it from there. It’s called “Razor Generator” (not to be confused with “Razor Single File Generator for MVC”).&lt;br /&gt;
&lt;h2&gt;Generator Types&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;MvcHelper&lt;/b&gt;: Creates a static type that is best suited for writing Mvc specific helper methods. &lt;/li&gt;
&lt;li&gt;&lt;b&gt;MvcView&lt;/b&gt;: Create a WebViewPage which allows the use of precompiled MVC views.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;WebPage&lt;/b&gt;: Creates a WebPage type that can be used as WebPages Application Part (such as _Admin and RazorDebugger).&lt;/li&gt;
&lt;li&gt;&lt;b&gt;WebPagesHelper&lt;/b&gt;: Creates a HelperPage type that is suited for precompiling and distributing WebPages helper.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Template&lt;/b&gt;: Generator based on T4 preprocessed template. &lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;
&lt;h2&gt;Usage in an MVC app&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;Install the &amp;#39;RazorGenerator.Mvc&amp;#39; package, which registers a special view engine&lt;/li&gt;
&lt;li&gt;Go to an MVC Razor view&amp;#39;s property and set the &lt;b&gt;Custom tool&lt;/b&gt; to &lt;b&gt;RazorGenerator&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Optionally specify a value for Custom Tool Namespace to specify a namespace for the generated file. The project namespace is used by default.&lt;/li&gt;
&lt;li&gt;Optionally specify one of the generators in the first line of your Razor file. A generator declaration line looks like this: &lt;span class="codeInline"&gt; @* Generator: MvcHelper *@ &lt;/span&gt;. If you don&amp;#39;t specify this, a generator is picked based on convention (e.g. files under Views are treated as MvcViews)&lt;/li&gt;
&lt;li&gt;You&amp;#39;ll see a generated .cs file under the .cshtml file, which will be used at runtime instead of the .cshtml file&lt;/li&gt;
&lt;li&gt;You can also go to the nuget Package Manager Console and run &amp;#39;Enable-RazorGenerator&amp;#39; to enable the Custom Tool on all the views.&lt;/li&gt;
&lt;li&gt;And to cause all the views to be regenerated, go to the nuget Package Manager Console and run &amp;#39;Redo-RazorGenerator&amp;#39;. This is useful when you update the generator package and it needs to generate different code.&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Usage in a View Library&lt;/h2&gt;
If you need to create a separate library for your precompiled MVC views, the best approach is to actually create an MVC project for that library, instead of a library project. You&amp;#39;ll never actually run it as an Mvc app, but the fact that it comes with the right set of config files allows intellisense and other things to work a lot better than in a library project.&lt;br /&gt;&lt;br /&gt;You can then add a reference to that &amp;#39;MVC View project&amp;#39; from your real MVC app.&lt;br /&gt;&lt;br /&gt;And note that you need to install the &amp;#39;RazorGenerator.Mvc&amp;#39; package into the library, not the main MVC app.&lt;br /&gt;&lt;br /&gt;See &lt;a href="https://github.com/davidebbo/MvcApplicationRazorGeneratorSeparateLibrary"&gt;https://github.com/davidebbo/MvcApplicationRazorGeneratorSeparateLibrary&lt;/a&gt; for a sample.&lt;br /&gt;
&lt;h2&gt;Special Razor directives&lt;/h2&gt;
These directives go at the top of the cshtml file.&lt;br /&gt;
&lt;h3&gt;disabling line pragmas&lt;/h3&gt;
@* DisableLinePragmas: true *@&lt;br /&gt;
&lt;h3&gt;Using absolute paths in line pragmas instead of relative&lt;/h3&gt;
@* GenerateAbsolutePathLinePragmas: true *@&lt;br /&gt;
&lt;h2&gt;History&lt;/h2&gt;
&lt;h3&gt;5/4/2013 Runtime v2.0.1&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Fixed regression &lt;a href="https://razorgenerator.codeplex.com/workitem/107"&gt;https://razorgenerator.codeplex.com/workitem/107&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;4/25/2013&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;v2.0: All the runtime assemblies are now signed.&lt;/li&gt;
&lt;li&gt;View activation process unification &lt;a href="https://razorgenerator.codeplex.com/workitem/105"&gt;https://razorgenerator.codeplex.com/workitem/105&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;10/14/2012&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Version 1.5 of the VSIX adds support for Razor 2.0 syntax. It auto detects whether it should use 1.0 or 2.0 based on the assembly being referenced by the project.&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;4/20/2012&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Version 1.4 of RazorGenerator.Mvc issue with multiple registered view engines (http://razorgenerator.codeplex.com/workitem/55), adds support for overriding the layout page when returning ViewResults and fixes a bug in UsePhysicalViewsIfNewer&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1/8/2012&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Version 1.2.3 of the VSIX fixes MVC4 issue (http://razorgenerator.codeplex.com/workitem/26)&lt;/li&gt;
&lt;li&gt;Version 1.3.1 of RazorGenerator.Testing fixes an issue with RenderAsHtml not flowing the context&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.2 (8/29/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Renamed all packages to be RazorGenerator.*&lt;/li&gt;
&lt;li&gt;Fix issue http://razorgenerator.codeplex.com/workitem/22 (Line pragmas should not use absolute paths)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1.2 (8/4/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Fixed encoding issue when using ANSI (non UTF-8) razor files (&lt;a href="http://razorgenerator.codeplex.com/workitem/15"&gt;http://razorgenerator.codeplex.com/workitem/15&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Support null values in simple template scenario. e.g. @foo when foo is null now renders empty string. (&lt;a href="http://razorgenerator.codeplex.com/workitem/16"&gt;http://razorgenerator.codeplex.com/workitem/16&lt;/a&gt;)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1.1 (7/11/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Change the generated file extensions from foo.cs to foo.generated.cs (&lt;a href="http://razorgenerator.codeplex.com/workitem/8"&gt;http://razorgenerator.codeplex.com/workitem/8&lt;/a&gt;)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1 (7/7/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;The generator now finds imported namespaces defined in web.config&lt;/li&gt;
&lt;li&gt;Add support for project level directives in a razorgenerator.directives file&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.0.1 (6/21/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Fix generated line pragmas&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.0&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Original release&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Related blog posts:&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.davidebbo.com/search/label/RazorGenerator"&gt;http://blog.davidebbo.com/search/label/RazorGenerator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/b/davidebb/archive/2010/10/27/turn-your-razor-helpers-into-reusable-libraries.aspx"&gt;http://blogs.msdn.com/b/davidebb/archive/2010/10/27/turn-your-razor-helpers-into-reusable-libraries.aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>davidebbo</author><pubDate>Sat, 04 May 2013 14:09:02 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20130504020902P</guid></item><item><title>Updated Wiki: Home</title><link>https://razorgenerator.codeplex.com/wikipage?version=20</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;Razor Generator&lt;/h1&gt;
This is a Custom Tool for Visual Studio that allows processing Razor files at design time instead of runtime, allowing them to be built into an assembly for simpler reuse and distribution. &lt;br /&gt;&lt;br /&gt;Note that this tool currently only supports C#. VB support could probably be done if someone wants to help out with it!&lt;br /&gt;
&lt;h2&gt;Installation instructions&lt;/h2&gt;It’s on the VS extension gallery, so install it from there. It’s called “Razor Generator” (not to be confused with “Razor Single File Generator for MVC”).&lt;br /&gt;
&lt;h2&gt;Generator Types&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;MvcHelper&lt;/b&gt;: Creates a static type that is best suited for writing Mvc specific helper methods. &lt;/li&gt;
&lt;li&gt;&lt;b&gt;MvcView&lt;/b&gt;: Create a WebViewPage which allows the use of precompiled MVC views.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;WebPage&lt;/b&gt;: Creates a WebPage type that can be used as WebPages Application Part (such as _Admin and RazorDebugger).&lt;/li&gt;
&lt;li&gt;&lt;b&gt;WebPagesHelper&lt;/b&gt;: Creates a HelperPage type that is suited for precompiling and distributing WebPages helper.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Template&lt;/b&gt;: Generator based on T4 preprocessed template. &lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;
&lt;h2&gt;Usage in an MVC app&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;Install the &amp;#39;RazorGenerator.Mvc&amp;#39; package, which registers a special view engine&lt;/li&gt;
&lt;li&gt;Go to an MVC Razor view&amp;#39;s property and set the &lt;b&gt;Custom tool&lt;/b&gt; to &lt;b&gt;RazorGenerator&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Optionally specify a value for Custom Tool Namespace to specify a namespace for the generated file. The project namespace is used by default.&lt;/li&gt;
&lt;li&gt;Optionally specify one of the generators in the first line of your Razor file. A generator declaration line looks like this: &lt;span class="codeInline"&gt; @* Generator: MvcHelper *@ &lt;/span&gt;. If you don&amp;#39;t specify this, a generator is picked based on convention (e.g. files under Views are treated as MvcViews)&lt;/li&gt;
&lt;li&gt;You&amp;#39;ll see a generated .cs file under the .cshtml file, which will be used at runtime instead of the .cshtml file&lt;/li&gt;
&lt;li&gt;You can also go to the nuget Package Manager Console and run &amp;#39;Enable-RazorGenerator&amp;#39; to enable the Custom Tool on all the views.&lt;/li&gt;
&lt;li&gt;And to cause all the views to be regenerated, go to the nuget Package Manager Console and run &amp;#39;Redo-RazorGenerator&amp;#39;. This is useful when you update the generator package and it needs to generate different code.&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Usage in a View Library&lt;/h2&gt;
If you need to create a separate library for your precompiled MVC views, the best approach is to actually create an MVC project for that library, instead of a library project. You&amp;#39;ll never actually run it as an Mvc app, but the fact that it comes with the right set of config files allows intellisense and other things to work a lot better than in a library project.&lt;br /&gt;&lt;br /&gt;You can then add a reference to that &amp;#39;MVC View project&amp;#39; from your real MVC app.&lt;br /&gt;&lt;br /&gt;And note that you need to install the &amp;#39;RazorGenerator.Mvc&amp;#39; package into the library, not the main MVC app.&lt;br /&gt;&lt;br /&gt;See &lt;a href="https://github.com/davidebbo/MvcApplicationRazorGeneratorSeparateLibrary"&gt;https://github.com/davidebbo/MvcApplicationRazorGeneratorSeparateLibrary&lt;/a&gt; for a sample.&lt;br /&gt;
&lt;h2&gt;Special Razor directives&lt;/h2&gt;
These directives go at the top of the cshtml file.&lt;br /&gt;
&lt;h3&gt;disabling line pragmas&lt;/h3&gt;
@* DisableLinePragmas: true *@&lt;br /&gt;
&lt;h3&gt;Using absolute paths in line pragmas instead of relative&lt;/h3&gt;
@* GenerateAbsolutePathLinePragmas: true *@&lt;br /&gt;
&lt;h2&gt;History&lt;/h2&gt;
&lt;h3&gt;4/25/2013&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;v2.0: All the runtime assemblies are now signed.&lt;/li&gt;
&lt;li&gt;View activation process unification &lt;a href="https://razorgenerator.codeplex.com/workitem/105"&gt;https://razorgenerator.codeplex.com/workitem/105&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;10/14/2012&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Version 1.5 of the VSIX adds support for Razor 2.0 syntax. It auto detects whether it should use 1.0 or 2.0 based on the assembly being referenced by the project.&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;4/20/2012&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Version 1.4 of RazorGenerator.Mvc issue with multiple registered view engines (http://razorgenerator.codeplex.com/workitem/55), adds support for overriding the layout page when returning ViewResults and fixes a bug in UsePhysicalViewsIfNewer&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1/8/2012&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Version 1.2.3 of the VSIX fixes MVC4 issue (http://razorgenerator.codeplex.com/workitem/26)&lt;/li&gt;
&lt;li&gt;Version 1.3.1 of RazorGenerator.Testing fixes an issue with RenderAsHtml not flowing the context&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.2 (8/29/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Renamed all packages to be RazorGenerator.*&lt;/li&gt;
&lt;li&gt;Fix issue http://razorgenerator.codeplex.com/workitem/22 (Line pragmas should not use absolute paths)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1.2 (8/4/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Fixed encoding issue when using ANSI (non UTF-8) razor files (&lt;a href="http://razorgenerator.codeplex.com/workitem/15"&gt;http://razorgenerator.codeplex.com/workitem/15&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Support null values in simple template scenario. e.g. @foo when foo is null now renders empty string. (&lt;a href="http://razorgenerator.codeplex.com/workitem/16"&gt;http://razorgenerator.codeplex.com/workitem/16&lt;/a&gt;)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1.1 (7/11/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Change the generated file extensions from foo.cs to foo.generated.cs (&lt;a href="http://razorgenerator.codeplex.com/workitem/8"&gt;http://razorgenerator.codeplex.com/workitem/8&lt;/a&gt;)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1 (7/7/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;The generator now finds imported namespaces defined in web.config&lt;/li&gt;
&lt;li&gt;Add support for project level directives in a razorgenerator.directives file&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.0.1 (6/21/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Fix generated line pragmas&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.0&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Original release&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Related blog posts:&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.davidebbo.com/search/label/RazorGenerator"&gt;http://blog.davidebbo.com/search/label/RazorGenerator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/b/davidebb/archive/2010/10/27/turn-your-razor-helpers-into-reusable-libraries.aspx"&gt;http://blogs.msdn.com/b/davidebb/archive/2010/10/27/turn-your-razor-helpers-into-reusable-libraries.aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>davidebbo</author><pubDate>Fri, 26 Apr 2013 05:28:49 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20130426052849A</guid></item><item><title>New Comment on "Using RazorGenerator.MsBuild"</title><link>https://razorgenerator.codeplex.com/wikipage?title=Using RazorGenerator.MsBuild&amp;ANCHOR#C27309</link><description>Crap instructions.</description><author>gangelo</author><pubDate>Fri, 26 Apr 2013 00:36:45 GMT</pubDate><guid isPermaLink="false">New Comment on "Using RazorGenerator.MsBuild" 20130426123645A</guid></item><item><title>New Comment on "Using RazorGenerator.MsBuild"</title><link>http://razorgenerator.codeplex.com/wikipage?title=Using RazorGenerator.MsBuild&amp;ANCHOR#C26508</link><description>The import is slightly incorrect it should be &amp;#10;&amp;#60;Import Project&amp;#61;&amp;#34;&amp;#36;&amp;#40;SolutionDir&amp;#41;&amp;#92;packages&amp;#92;RazorGenerator.MsBuild.1.5.0.0&amp;#92;tools&amp;#92;RazorGenerator.targets&amp;#34;&amp;#47;&amp;#62; &amp;#10;&amp;#10;The version is missing the 0.0</description><author>thecubical</author><pubDate>Tue, 12 Feb 2013 01:05:17 GMT</pubDate><guid isPermaLink="false">New Comment on "Using RazorGenerator.MsBuild" 20130212010517A</guid></item><item><title>Updated Wiki: Using RazorGenerator.MsBuild</title><link>http://razorgenerator.codeplex.com/wikipage?title=Using RazorGenerator.MsBuild&amp;version=5</link><description>&lt;div class="wikidoc"&gt;Unlike the Vsix which depends on Visual Studio&amp;#39;s single file generator tooling, RazorGenerator.MsBuild allows precompiling views independent of Visual Studio. It works by dynamically generating C# files for Views during build which are then compiled like ordinary files in the project. &lt;br /&gt;
&lt;h3&gt;Installing the package&lt;/h3&gt;To use the package, install the package using NuGet.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Install-Package RazorGenerator.MsBuild&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;If you have NuGet Package Restore enabled, the package will wire up the the target file for you. This is done by adding an import to the package restore target file.&lt;br /&gt;
&lt;h3&gt;Enabling the target without NuGet Package restore&lt;/h3&gt;If you do not have package restore enabled, you&amp;#39;ll need to&lt;br /&gt;&lt;br /&gt;a) Import the RazorGenerator.target file in your application&lt;br /&gt;&lt;span class="codeInline"&gt; &amp;lt;Import Project=&amp;quot;$(SolutionDir)\packages\RazorGenerator.MsBuild.1.5\tools\RazorGenerator.targets&amp;quot;/&amp;gt; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;b) Add a property to your project&lt;br /&gt;&lt;span class="codeInline"&gt;&amp;lt;PrecompileRazorFiles&amp;gt;true&amp;lt;/PrecompileRazorFiles&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3&gt;Verifying if it works&lt;/h3&gt;To verify that the Msbuild target has been set up correctly, check if files are being generated under the obj\CodeGen directory of your application.&lt;br /&gt;
&lt;h3&gt;Customizing the target&lt;/h3&gt;The target file assumes some default values for properties and itemgroups. These values can be overridden from your csproj &lt;br /&gt;
&lt;ul&gt;&lt;li&gt;RazorSrcFiles - ItemGroup - the files that the generator precompiles. Defaults to any cshtml file under the project&amp;#39;s directory. For instance, to customize it to only include files under the Views directory, add this &lt;a href="http://razorgenerator.codeplex.com/wikipage?title=ItemGroup&amp;referringTitle=Using%20RazorGenerator.MsBuild"&gt;ItemGroup&lt;/a&gt;(http://msdn.microsoft.com/en-us/library/646dk05y%28v=VS.80%29.aspx) to your csproj. &lt;/li&gt;&lt;/ul&gt;
&lt;pre&gt;
&amp;lt;ItemGroup&amp;gt;
    &amp;lt;RazorSrcFiles Include=&amp;quot;Views\**\*.cshtml&amp;quot; /&amp;gt;
&amp;lt;/ItemGroup&amp;gt;
&lt;/pre&gt;
&lt;ul&gt;&lt;li&gt;RazorViewsCodeGenDirectory- the directory at which files are precompiled to. Defalts to obj/CodeGen directory. You can change this by specifying a value for this property from your csproj&lt;/li&gt;&lt;/ul&gt;
&lt;span class="codeInline"&gt; &amp;lt;RazorViewsCodeGenDirectory&amp;gt;$(Temp)\Myproject\RazorTempFiles\/&amp;lt;RazorViewsCodeGenDirectory&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Note&lt;/i&gt;: Property and Item group declarations must occur before the msbuild target Import&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>pranavkm</author><pubDate>Wed, 19 Dec 2012 18:12:06 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Using RazorGenerator.MsBuild 20121219061206P</guid></item><item><title>Updated Wiki: Using RazorGenerator.MsBuild</title><link>http://razorgenerator.codeplex.com/wikipage?title=Using RazorGenerator.MsBuild&amp;version=4</link><description>&lt;div class="wikidoc"&gt;Unlike the Vsix which depends on Visual Studio&amp;#39;s single file generator tooling, RazorGenerator.MsBuild allows precompiling views independent of Visual Studio. It works by dynamically generating C# files for Views during build which are then compiled like ordinary files in the project. &lt;br /&gt;
&lt;h2&gt;Installing the package&lt;/h2&gt;To use the package, install the package using NuGet.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Install-Package RazorGenerator.MsBuild&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;If you have NuGet Package Restore enabled, the package will wire up the the target file for you. This is done by adding an import to the package restore target file.&lt;br /&gt;
&lt;h3&gt;Enabling the target without NuGet Package restore&lt;/h3&gt;If you do not have package restore enabled, you&amp;#39;ll need to&lt;br /&gt;&lt;br /&gt;a) Import the RazorGenerator.target file in your application&lt;br /&gt;&lt;span class="codeInline"&gt; &amp;lt;Import Project=&amp;quot;$(SolutionDir)\packages\RazorGenerator.MsBuild.1.5\tools\RazorGenerator.targets&amp;quot;/&amp;gt; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;b) Add a property to your project&lt;br /&gt;&lt;span class="codeInline"&gt;&amp;lt;PrecompileRazorFiles&amp;gt;true&amp;lt;/PrecompileRazorFiles&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3&gt;Verifying if it works&lt;/h3&gt;To verify that the Msbuild target has been set up correctly, check if files are being generated under the obj\CodeGen directory of your application.&lt;br /&gt;
&lt;h3&gt;Customizing the target&lt;/h3&gt;The target file assumes some default values for properties and itemgroups. These values can be overridden from your csproj &lt;br /&gt;
&lt;ul&gt;&lt;li&gt;RazorSrcFiles - ItemGroup - the files that the generator precompiles. Defaults to any cshtml file under the project&amp;#39;s directory. For instance, to customize it to only include files under the Views directory, add this &lt;a href="http://razorgenerator.codeplex.com/wikipage?title=ItemGroup&amp;referringTitle=Using%20RazorGenerator.MsBuild"&gt;ItemGroup&lt;/a&gt;(http://msdn.microsoft.com/en-us/library/646dk05y%28v=VS.80%29.aspx) to your csproj. &lt;/li&gt;&lt;/ul&gt;
&lt;pre&gt;
&amp;lt;ItemGroup&amp;gt;
    &amp;lt;RazorSrcFiles Include=&amp;quot;Views\**\*.cshtml&amp;quot; /&amp;gt;
&amp;lt;/ItemGroup&amp;gt;
&lt;/pre&gt;
&lt;ul&gt;&lt;li&gt;RazorViewsCodeGenDirectory- the directory at which files are precompiled to. Defalts to obj/CodeGen directory. You can change this by specifying a value for this property from your csproj&lt;/li&gt;&lt;/ul&gt;
&lt;span class="codeInline"&gt; &amp;lt;RazorViewsCodeGenDirectory&amp;gt;$(Temp)\Myproject\RazorTempFiles\/&amp;lt;RazorViewsCodeGenDirectory&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Note&lt;/i&gt;: Property and Item group declarations must occur before the msbuild target Import&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>pranavkm</author><pubDate>Wed, 19 Dec 2012 18:11:53 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Using RazorGenerator.MsBuild 20121219061153P</guid></item><item><title>Updated Wiki: Using RazorGenerator.Mvc</title><link>http://razorgenerator.codeplex.com/wikipage?title=Using RazorGenerator.Mvc&amp;version=4</link><description>&lt;div class="wikidoc"&gt;To consume precompiled views from your Mvc application, you would need to install the RazorGenerator.Mvc package.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="codeInline"&gt; Install-Package RazorGenerator.Mvc &lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;h2&gt;How it works&lt;/h2&gt;Views generated by the precompiled views contain a PageVirtualPath attribute that records the VirtualPath they correspond to. These values are constructed from the relative paths of the cshtml files under the Views directory. &lt;br /&gt;The package adds a pre-application start hook via the type RazorGeneratorMvcStart to include a ViewEngine to the Mvc&amp;#39;s list of engines. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) 
{
    UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal
};

ViewEngines.Engines.Insert(0, engine);

&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;Configuring the PrecompiledMvcEngine&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;By default, the PrecompiledViewEngine registers itself as the first ViewEngine to intercept Mvc&amp;#39;s calls for View lookups. Consequently, if a virtual path collides with another ViewEngine&amp;#39;s, then the precompiled engine wins. For example, if your Mvc application and your precompiled application have a View at ~/Home/Index.cshtml, the precompiled view wins. You can change this behavior by having the PrecompiledMvcEngine appear later in the ViewEngines list.&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;pre&gt;
ViewEngines.Engines.Add(engine);
&lt;/pre&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Mvc treats Layout files and &lt;i&gt;ViewStart files a bit differently than regular View files. Their lookup is done via the VirtualPathFactoryManager. To support this, our view engine implements the IVirtualPathFactory interface and registers itself during App&lt;/i&gt;Start.&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;pre&gt;
    // StartPage lookups are done by WebPages. 
VirtualPathFactoryManager.RegisterVirtualPathFactory(engine);
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Unlike the ViewEngine scenario, we choose to do the opposite with Layout and ViewStart files: if the path of a _ViewStart file or a Layout file exists both in your precompiled assembly and your Mvc application, we&amp;#39;ll choose the one in your Mvc application. &lt;br /&gt;&lt;br /&gt;You can change this behavior by setting the &lt;b&gt;PreemptPhysicalFiles&lt;/b&gt; to true on your engine:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
engine.PreemptPhysicalFiles = true;
&lt;/pre&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;To facilitate a simpler design time experience, the ViewEngine uses physical files if they are newer than the precompiled assembly. This is to avoid having to rebuild your assembly every time you make changes to your view file. You can turn off this behavior (or make it more complex), by changing this line of code:&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;pre&gt;
UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal
&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>pranavkm</author><pubDate>Mon, 12 Nov 2012 16:31:39 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Using RazorGenerator.Mvc 20121112043139P</guid></item><item><title>Updated Wiki: Using RazorGenerator.Mvc</title><link>http://razorgenerator.codeplex.com/wikipage?title=Using RazorGenerator.Mvc&amp;version=3</link><description>&lt;div class="wikidoc"&gt;To consume precompiled views from your Mvc application, you would need to install the RazorGenerator.Mvc package.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="codeInline"&gt; Install-Package RazorGenerator.Mvc &lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;h2&gt;How it works&lt;/h2&gt;Views generated by the precompiled views contain a PageVirtualPath attribute that records the VirtualPath they correspond to. These values are constructed from the relative paths of the cshtml files under the Views directory. &lt;br /&gt;The package adds a pre-application start hook via the type RazorGeneratorMvcStart to include a ViewEngine to the Mvc&amp;#39;s list of engines. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) 
{
    UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal
};

ViewEngines.Engines.Insert(0, engine);

&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;Configuring the PrecompiledMvcEngine&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;Be the first ViewEngine to intercept Mvc&amp;#39;s calls to look for Views. Consequently, if a virtual path collides with another ViewEngine&amp;#39;s, then the precompiled engine wins. For example, if your Mvc application and your precompiled application have a View at ~/Home/Index.cshtml, the precompiled view wins. You can change this behavior by having the PrecompiledMvcEngine appear later in the ViewEngines list.&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;pre&gt;
ViewEngines.Engines.Add(engine);
&lt;/pre&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Mvc treats Layout files and &lt;i&gt;ViewStart files a bit differently than regular View files. Their lookup is done via the VirtualPathFactoryManager. To support this, our view engine implements the IVirtualPathFactory interface and registers itself during App&lt;/i&gt;Start.&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;pre&gt;
    // StartPage lookups are done by WebPages. 
VirtualPathFactoryManager.RegisterVirtualPathFactory(engine);
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Unlike the ViewEngine scenario, we choose to do the opposite with Layout and ViewStart files: if the path of a _ViewStart file or a Layout file exists both in your precompiled assembly and your Mvc application, we&amp;#39;ll choose the one in your Mvc application. &lt;br /&gt;&lt;br /&gt;You can change this behavior by setting the &lt;b&gt;PreemptPhysicalFiles&lt;/b&gt; to true on your engine:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
engine.PreemptPhysicalFiles = true;
&lt;/pre&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;To facilitate a simpler design time experience, the ViewEngine uses physical files if they are newer than the precompiled assembly. This is to avoid having to rebuild your assembly every time you make changes to your view file. You can turn off this behavior (or make it more complex), by changing this line of code:&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;pre&gt;
UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal
&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>pranavkm</author><pubDate>Mon, 12 Nov 2012 16:26:26 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Using RazorGenerator.Mvc 20121112042626P</guid></item><item><title>Updated Wiki: Documentation</title><link>http://razorgenerator.codeplex.com/documentation?version=5</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;Table of Contents&lt;/h1&gt;
&lt;ol&gt;&lt;li&gt;&lt;a href="http://razorgenerator.codeplex.com/wikipage?title=Quick%20Start%20Guide&amp;referringTitle=Documentation"&gt;Quick Start Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://razorgenerator.codeplex.com/wikipage?title=Precompiled%20WebPages&amp;referringTitle=Documentation"&gt;Precompiled WebPages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://razorgenerator.codeplex.com/wikipage?title=Precompiled%20MVC%20Views&amp;referringTitle=Documentation"&gt;Precompiled MVC Views&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://razorgenerator.codeplex.com/wikipage?title=Using%20RazorGenerator.MsBuild&amp;referringTitle=Documentation"&gt;Using RazorGenerator.MsBuild&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://razorgenerator.codeplex.com/wikipage?title=Using%20RazorGenerator.Mvc&amp;referringTitle=Documentation"&gt;Using RazorGenerator.Mvc&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>pranavkm</author><pubDate>Mon, 12 Nov 2012 16:25:50 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Documentation 20121112042550P</guid></item><item><title>Updated Wiki: Using RazorGenerator.Mvc</title><link>http://razorgenerator.codeplex.com/wikipage?title=Using RazorGenerator.Mvc&amp;version=2</link><description>&lt;div class="wikidoc"&gt;To consume precompiled views from your Mvc application, you would need to install the RazorGenerator.Mvc package.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="codeInline"&gt; Install-Package RazorGenerator.Mvc &lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;h2&gt;How it works&lt;/h2&gt;Views generated by the precompiled views contain a PageVirtualPath attribute that records the VirtualPath they correspond to. These values are constructed from the relative paths of the cshtml files under the Views directory. &lt;br /&gt;The package adds a pre-application start hook via the type RazorGeneratorMvcStart to include a ViewEngine to the Mvc&amp;#39;s list of engines. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
            var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) 
            {
                UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal
            };

            ViewEngines.Engines.Insert(0, engine);

&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;Configuring the PrecompiledMvcEngine&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;Be the first ViewEngine to intercept Mvc&amp;#39;s calls to look for Views. Consequently, if a virtual path collides with another ViewEngine&amp;#39;s, then the precompiled engine wins. For example, if your Mvc application and your precompiled application have a View at ~/Home/Index.cshtml, the precompiled view wins. You can change this behavior by having the PrecompiledMvcEngine appear later in the ViewEngines list.&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;pre&gt;
         ViewEngines.Engines.Add(engine);
&lt;/pre&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Mvc treats Layout files and &lt;i&gt;ViewStart files a bit differently than regular View files. Their lookup is done via the VirtualPathFactoryManager. To support this, our view engine implements the IVirtualPathFactory interface and registers itself during App&lt;/i&gt;Start.&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;pre&gt;
    // StartPage lookups are done by WebPages. 
    VirtualPathFactoryManager.RegisterVirtualPathFactory(engine);
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Unlike the ViewEngine scenario, we choose to do the opposite with Layout and ViewStart files: if the path of a _ViewStart file or a Layout file exists both in your precompiled assembly and your Mvc application, we&amp;#39;ll choose the one in your Mvc application. &lt;br /&gt;&lt;br /&gt;You can change this behavior by setting the &lt;b&gt;PreemptPhysicalFiles&lt;/b&gt; to true on your engine:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
    engine.PreemptPhysicalFiles = true;
&lt;/pre&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;To facilitate a simpler design time experience, the ViewEngine uses physical files if they are newer than the precompiled assembly. This is to avoid having to rebuild your assembly every time you make changes to your view file. You can turn off this behavior (or make it more complex), by changing this line of code:&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;pre&gt;
        UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal
&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>pranavkm</author><pubDate>Mon, 12 Nov 2012 16:25:35 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Using RazorGenerator.Mvc 20121112042535P</guid></item><item><title>Updated Wiki: Using RazorGenerator.Mvc</title><link>http://razorgenerator.codeplex.com/wikipage?title=Using RazorGenerator.Mvc&amp;version=1</link><description>&lt;div class="wikidoc"&gt;To consume precompiled views from your Mvc application, you would need to install the RazorGenerator.Mvc package.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="codeInline"&gt; Install-Package RazorGenerator.Mvc &lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;h2&gt;How it works&lt;/h2&gt;Views generated by the precompiled views contain a PageVirtualPath attribute that records the VirtualPath they correspond to. These values are constructed from the relative paths of the cshtml files under the Views directory. &lt;br /&gt;The package adds a pre-application start hook via the type RazorGeneratorMvcStart to include a ViewEngine to the Mvc&amp;#39;s list of engines. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
            var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) {
                UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal
            };

            ViewEngines.Engines.Insert(0, engine);

&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;Configuring the PrecompiledMvcEngine&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;Be the first ViewEngine to intercept Mvc&amp;#39;s calls to look for Views. Consequently, if a virtual path collides with another ViewEngine&amp;#39;s, then the precompiled engine wins. For example, if your Mvc application and your precompiled application have a View at ~/Home/Index.cshtml, the precompiled view wins. You can change this behavior by having the PrecompiledMvcEngine appear later in the ViewEngines list.&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;pre&gt;
         ViewEngines.Engines.Add(engine);
&lt;/pre&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Mvc treats Layout files and &lt;i&gt;ViewStart files a bit differently than regular View files. Their lookup is done via the VirtualPathFactoryManager. To support this, our view engine implements the IVirtualPathFactory interface and registers itself during App&lt;/i&gt;Start.&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;pre&gt;
    // StartPage lookups are done by WebPages. 
    VirtualPathFactoryManager.RegisterVirtualPathFactory(engine);
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Unlike the ViewEngine scenario, we choose to do the opposite with Layout and ViewStart files: if the path of a _ViewStart file or a Layout file exists both in your precompiled assembly and your Mvc application, we&amp;#39;ll choose the one in your Mvc application. &lt;br /&gt;&lt;br /&gt;You can change this behavior by setting the &lt;b&gt;PreemptPhysicalFiles&lt;/b&gt; to true on your engine:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
    engine.PreemptPhysicalFiles = true;
&lt;/pre&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;To facilitate a simpler design time experience, the ViewEngine uses physical files if they are newer than the precompiled assembly. This is to avoid having to rebuild your assembly every time you make changes to your view file. You can turn off this behavior (or make it more complex), by changing this line of code:&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;pre&gt;
        UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal
&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>pranavkm</author><pubDate>Mon, 12 Nov 2012 16:25:05 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Using RazorGenerator.Mvc 20121112042505P</guid></item><item><title>Updated Wiki: Using RazorGenerator.MsBuild</title><link>http://razorgenerator.codeplex.com/wikipage?title=Using RazorGenerator.MsBuild&amp;version=3</link><description>&lt;div class="wikidoc"&gt;Unlike the Vsix which depends on Visual Studio&amp;#39;s single file generator tooling, RazorGenerator.MsBuild allows precompiling views independent of Visual Studio. It works by dynamically generating C# files for Views during build which are then compiled like ordinary files in the project. &lt;br /&gt;&lt;br /&gt;To use the package, install the package using NuGet.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Install-Package RazorGenerator.MsBuild&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;If you have NuGet Package Restore enabled, the package will wire up the the target file for you. This is done by adding an import to the package restore target file.&lt;br /&gt;&lt;br /&gt;If you do not have package restore enabled, you&amp;#39;ll need to&lt;br /&gt;&lt;br /&gt;a) Import the RazorGenerator.target file in your application&lt;br /&gt;&lt;b&gt;&amp;lt;Import Project=&amp;quot;$(SolutionDir)\packages\RazorGenerator.MsBuild.1.5\tools\RazorGenerator.targets&amp;quot;/&amp;gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;b) Add a property to your project&lt;br /&gt;&lt;b&gt;&amp;lt;PrecompileRazorFiles&amp;gt;true&amp;lt;/PrecompileRazorFiles&amp;gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;To verify that the Msbuild target has been set up correctly, check if files are being generated under the obj\CodeGen directory of your application.&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>pranavkm</author><pubDate>Thu, 08 Nov 2012 20:11:48 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Using RazorGenerator.MsBuild 20121108081148P</guid></item><item><title>Updated Wiki: Documentation</title><link>http://razorgenerator.codeplex.com/documentation?version=4</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;Table of Contents&lt;/h1&gt;
&lt;ol&gt;&lt;li&gt;&lt;a href="http://razorgenerator.codeplex.com/wikipage?title=Quick%20Start%20Guide&amp;referringTitle=Documentation"&gt;Quick Start Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://razorgenerator.codeplex.com/wikipage?title=Precompiled%20WebPages&amp;referringTitle=Documentation"&gt;Precompiled WebPages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://razorgenerator.codeplex.com/wikipage?title=Precompiled%20MVC%20Views&amp;referringTitle=Documentation"&gt;Precompiled MVC Views&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://razorgenerator.codeplex.com/wikipage?title=Using%20RazorGenerator.MsBuild&amp;referringTitle=Documentation"&gt;Using RazorGenerator.MsBuild&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>pranavkm</author><pubDate>Thu, 08 Nov 2012 03:17:30 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Documentation 20121108031730A</guid></item><item><title>Updated Wiki: Using RazorGenerator.MsBuild</title><link>http://razorgenerator.codeplex.com/wikipage?title=Using RazorGenerator.MsBuild&amp;version=2</link><description>&lt;div class="wikidoc"&gt;Unlike the Vsix which depends on Visual Studio&amp;#39;s single file generator tooling, RazorGenerator.MsBuild allows precompiling views independent of Visual Studio. It works by dynamically generating C# files for Views during build which are then compiled like ordinary files in the project. &lt;br /&gt;&lt;br /&gt;To use the package, install the package using NuGet.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Install-Package RazorGenerator.MsBuild&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;If you have NuGet Package Restore enabled, the package will wire up the the target file for you. This is done by adding an import to the package restore target file.&lt;br /&gt;&lt;br /&gt;If you do not have package restore enabled, you&amp;#39;ll need to&lt;br /&gt;&lt;br /&gt;a) Import the RazorGenerator.target file in your application&lt;br /&gt;&lt;b&gt;&amp;lt;Import Project=&amp;quot;$(SolutionDir)\packages\RazorGenerator.MsBuild.1.5\tools\RazorGenerator.msbuild&amp;quot;/&amp;gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;b) Add a property to your project&lt;br /&gt;&lt;b&gt;&amp;lt;PrecompileRazorFiles&amp;gt;true&amp;lt;/PrecompileRazorFiles&amp;gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;To verify that the Msbuild target has been set up correctly, check if files are being generated under the obj\CodeGen directory of your application.&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>pranavkm</author><pubDate>Thu, 08 Nov 2012 03:17:15 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Using RazorGenerator.MsBuild 20121108031715A</guid></item><item><title>Updated Wiki: Using RazorGenerator.MsBuild</title><link>http://razorgenerator.codeplex.com/wikipage?title=Using RazorGenerator.MsBuild&amp;version=1</link><description>&lt;div class="wikidoc"&gt;Unlike the Vsix which depends on Visual Studio&amp;#39;s single file generator tooling, RazorGenerator.MsBuild allows precompiling views independent of Visual Studio. It works by dynamically generating C# files for Views during build which are then compiled like ordinary files in the project. &lt;br /&gt;&lt;br /&gt;To use the package, install the package using NuGet.&lt;br /&gt;&lt;br /&gt;Install-Package RazorGenerator.MsBuild&lt;br /&gt;&lt;br /&gt;If you have NuGet Package Restore enabled, the package will wire up the the target file for you. This is done by adding an import to the package restore target file.&lt;br /&gt;&lt;br /&gt;If you do not have package restore enabled, you&amp;#39;ll need to&lt;br /&gt;&lt;br /&gt;a) Import the RazorGenerator.target file in your application&lt;br /&gt;&amp;lt;Import Project=&amp;quot;$(SolutionDir)\packages\RazorGenerator.MsBuild.1.5\tools\RazorGenerator.msbuild&amp;quot;/&amp;gt;&lt;br /&gt;&lt;br /&gt;b) Add a property to your project&lt;br /&gt;&amp;lt;PrecompileRazorFiles&amp;gt;true&amp;lt;/PrecompileRazorFiles&amp;gt;&lt;br /&gt;&lt;br /&gt;To verify that the Msbuild target has been set up correctly, check if files are being generated under the obj\CodeGen directory of your application.&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>pranavkm</author><pubDate>Thu, 08 Nov 2012 03:16:48 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Using RazorGenerator.MsBuild 20121108031648A</guid></item><item><title>Updated Wiki: Home</title><link>http://razorgenerator.codeplex.com/wikipage?version=19</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;Razor Generator&lt;/h1&gt;
This is a Custom Tool for Visual Studio that allows processing Razor files at design time instead of runtime, allowing them to be built into an assembly for simpler reuse and distribution. &lt;br /&gt;&lt;br /&gt;Note that this tool currently only supports C#. VB support could probably be done if someone wants to help out with it!&lt;br /&gt;
&lt;h2&gt;Installation instructions&lt;/h2&gt;It’s on the VS extension gallery, so install it from there. It’s called “Razor Generator” (not to be confused with “Razor Single File Generator for MVC”).&lt;br /&gt;
&lt;h2&gt;Generator Types&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;MvcHelper&lt;/b&gt;: Creates a static type that is best suited for writing Mvc specific helper methods. &lt;/li&gt;
&lt;li&gt;&lt;b&gt;MvcView&lt;/b&gt;: Create a WebViewPage which allows the use of precompiled MVC views.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;WebPage&lt;/b&gt;: Creates a WebPage type that can be used as WebPages Application Part (such as _Admin and RazorDebugger).&lt;/li&gt;
&lt;li&gt;&lt;b&gt;WebPagesHelper&lt;/b&gt;: Creates a HelperPage type that is suited for precompiling and distributing WebPages helper.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Template&lt;/b&gt;: Generator based on T4 preprocessed template. &lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;
&lt;h2&gt;Usage in an MVC app&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;Install the &amp;#39;RazorGenerator.Mvc&amp;#39; package, which registers a special view engine&lt;/li&gt;
&lt;li&gt;Go to an MVC Razor view&amp;#39;s property and set the &lt;b&gt;Custom tool&lt;/b&gt; to &lt;b&gt;RazorGenerator&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Optionally specify a value for Custom Tool Namespace to specify a namespace for the generated file. The project namespace is used by default.&lt;/li&gt;
&lt;li&gt;Optionally specify one of the generators in the first line of your Razor file. A generator declaration line looks like this: &lt;span class="codeInline"&gt; @* Generator: MvcHelper *@ &lt;/span&gt;. If you don&amp;#39;t specify this, a generator is picked based on convention (e.g. files under Views are treated as MvcViews)&lt;/li&gt;
&lt;li&gt;You&amp;#39;ll see a generated .cs file under the .cshtml file, which will be used at runtime instead of the .cshtml file&lt;/li&gt;
&lt;li&gt;You can also go to the nuget Package Manager Console and run &amp;#39;Enable-RazorGenerator&amp;#39; to enable the Custom Tool on all the views.&lt;/li&gt;
&lt;li&gt;And to cause all the views to be regenerated, go to the nuget Package Manager Console and run &amp;#39;Redo-RazorGenerator&amp;#39;. This is useful when you update the generator package and it needs to generate different code.&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Usage in a View Library&lt;/h2&gt;
If you need to create a separate library for your precompiled MVC views, the best approach is to actually create an MVC project for that library, instead of a library project. You&amp;#39;ll never actually run it as an Mvc app, but the fact that it comes with the right set of config files allows intellisense and other things to work a lot better than in a library project.&lt;br /&gt;&lt;br /&gt;You can then add a reference to that &amp;#39;MVC View project&amp;#39; from your real MVC app.&lt;br /&gt;&lt;br /&gt;And note that you need to install the &amp;#39;RazorGenerator.Mvc&amp;#39; package into the library, not the main MVC app.&lt;br /&gt;&lt;br /&gt;See &lt;a href="https://github.com/davidebbo/MvcApplicationRazorGeneratorSeparateLibrary"&gt;https://github.com/davidebbo/MvcApplicationRazorGeneratorSeparateLibrary&lt;/a&gt; for a sample.&lt;br /&gt;
&lt;h2&gt;Special Razor directives&lt;/h2&gt;
These directives go at the top of the cshtml file.&lt;br /&gt;
&lt;h3&gt;disabling line pragmas&lt;/h3&gt;
@* DisableLinePragmas: true *@&lt;br /&gt;
&lt;h3&gt;Using absolute paths in line pragmas instead of relative&lt;/h3&gt;
@* GenerateAbsolutePathLinePragmas: true *@&lt;br /&gt;
&lt;h2&gt;History&lt;/h2&gt;
&lt;h3&gt;10/14/2012&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Version 1.5 of the VSIX adds support for Razor 2.0 syntax. It auto detects whether it should use 1.0 or 2.0 based on the assembly being referenced by the project.&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;4/20/2012&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Version 1.4 of RazorGenerator.Mvc issue with multiple registered view engines (http://razorgenerator.codeplex.com/workitem/55), adds support for overriding the layout page when returning ViewResults and fixes a bug in UsePhysicalViewsIfNewer&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1/8/2012&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Version 1.2.3 of the VSIX fixes MVC4 issue (http://razorgenerator.codeplex.com/workitem/26)&lt;/li&gt;
&lt;li&gt;Version 1.3.1 of RazorGenerator.Testing fixes an issue with RenderAsHtml not flowing the context&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.2 (8/29/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Renamed all packages to be RazorGenerator.*&lt;/li&gt;
&lt;li&gt;Fix issue http://razorgenerator.codeplex.com/workitem/22 (Line pragmas should not use absolute paths)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1.2 (8/4/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Fixed encoding issue when using ANSI (non UTF-8) razor files (&lt;a href="http://razorgenerator.codeplex.com/workitem/15"&gt;http://razorgenerator.codeplex.com/workitem/15&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Support null values in simple template scenario. e.g. @foo when foo is null now renders empty string. (&lt;a href="http://razorgenerator.codeplex.com/workitem/16"&gt;http://razorgenerator.codeplex.com/workitem/16&lt;/a&gt;)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1.1 (7/11/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Change the generated file extensions from foo.cs to foo.generated.cs (&lt;a href="http://razorgenerator.codeplex.com/workitem/8"&gt;http://razorgenerator.codeplex.com/workitem/8&lt;/a&gt;)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1 (7/7/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;The generator now finds imported namespaces defined in web.config&lt;/li&gt;
&lt;li&gt;Add support for project level directives in a razorgenerator.directives file&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.0.1 (6/21/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Fix generated line pragmas&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.0&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Original release&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Related blog posts:&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.davidebbo.com/search/label/RazorGenerator"&gt;http://blog.davidebbo.com/search/label/RazorGenerator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/b/davidebb/archive/2010/10/27/turn-your-razor-helpers-into-reusable-libraries.aspx"&gt;http://blogs.msdn.com/b/davidebb/archive/2010/10/27/turn-your-razor-helpers-into-reusable-libraries.aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>davidebbo</author><pubDate>Wed, 17 Oct 2012 05:16:14 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20121017051614A</guid></item><item><title>Updated Wiki: Home</title><link>http://razorgenerator.codeplex.com/wikipage?version=18</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;Razor Generator&lt;/h1&gt;
This is a Custom Tool for Visual Studio that allows processing Razor files at design time instead of runtime, allowing them to be built into an assembly for simpler reuse and distribution. &lt;br /&gt;&lt;br /&gt;Note that this tool currently only supports C#. VB support could probably be done if someone wants to help out with it!&lt;br /&gt;
&lt;h2&gt;Installation instructions&lt;/h2&gt;It’s on the VS extension gallery, so install it from there. It’s called “Razor Generator” (not to be confused with “Razor Single File Generator for MVC”).&lt;br /&gt;
&lt;h2&gt;Generator Types&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;MvcHelper&lt;/b&gt;: Creates a static type that is best suited for writing Mvc specific helper methods. &lt;/li&gt;
&lt;li&gt;&lt;b&gt;MvcView&lt;/b&gt;: Create a WebViewPage which allows the use of precompiled MVC views.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;WebPage&lt;/b&gt;: Creates a WebPage type that can be used as WebPages Application Part (such as _Admin and RazorDebugger).&lt;/li&gt;
&lt;li&gt;&lt;b&gt;WebPagesHelper&lt;/b&gt;: Creates a HelperPage type that is suited for precompiling and distributing WebPages helper.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Template&lt;/b&gt;: Generator based on T4 preprocessed template. &lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;
&lt;h2&gt;Usage in an MVC app&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;Install the &amp;#39;RazorGenerator.Mvc&amp;#39; package, which registers a special view engine&lt;/li&gt;
&lt;li&gt;Go to an MVC Razor view&amp;#39;s property and set the &lt;b&gt;Custom tool&lt;/b&gt; to &lt;b&gt;RazorGenerator&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Optionally specify a value for Custom Tool Namespace to specify a namespace for the generated file. The project namespace is used by default.&lt;/li&gt;
&lt;li&gt;Optionally specify one of the generators in the first line of your Razor file. A generator declaration line looks like this: &lt;span class="codeInline"&gt; @* Generator: MvcHelper *@ &lt;/span&gt;. If you don&amp;#39;t specify this, a generator is picked based on convention (e.g. files under Views are treated as MvcViews)&lt;/li&gt;
&lt;li&gt;You&amp;#39;ll see a generated .cs file under the .cshtml file, which will be used at runtime instead of the .cshtml file&lt;/li&gt;
&lt;li&gt;You can also go to the nuget Package Manager Console and run &amp;#39;Enable-RazorGenerator&amp;#39; to enable the Custom Tool on all the views.&lt;/li&gt;
&lt;li&gt;And to cause all the views to be regenerated, go to the nuget Package Manager Console and run &amp;#39;Redo-RazorGenerator&amp;#39;. This is useful when you update the generator package and it needs to generate different code.&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Usage in a View Library&lt;/h2&gt;
If you need to create a separate library for your precompiled MVC views, the best approach is to actually create an MVC project for that library, instead of a library project. You&amp;#39;ll never actually run it as an Mvc app, but the fact that it comes with the right set of config files allows intellisense and other things to work a lot better than in a library project.&lt;br /&gt;&lt;br /&gt;You can then add a reference to that &amp;#39;MVC View project&amp;#39; from your real MVC app.&lt;br /&gt;&lt;br /&gt;And note that you need to install the &amp;#39;RazorGenerator.Mvc&amp;#39; package into the library, not the main MVC app.&lt;br /&gt;&lt;br /&gt;See &lt;a href="https://github.com/davidebbo/MvcApplicationRazorGeneratorSeparateLibrary"&gt;https://github.com/davidebbo/MvcApplicationRazorGeneratorSeparateLibrary&lt;/a&gt; for a sample.&lt;br /&gt;
&lt;h2&gt;Special Razor directives&lt;/h2&gt;
These directives go at the top of the cshtml file.&lt;br /&gt;
&lt;h3&gt;disabling line pragmas&lt;/h3&gt;
@* DisableLinePragmas: true *@&lt;br /&gt;
&lt;h3&gt;Using absolute paths in line pragmas instead of relative&lt;/h3&gt;
@* GenerateAbsolutePathLinePragmas: true *@&lt;br /&gt;
&lt;h2&gt;History&lt;/h2&gt;
&lt;h3&gt;4/20/2012&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Version 1.4 of RazorGenerator.Mvc issue with multiple registered view engines (http://razorgenerator.codeplex.com/workitem/55), adds support for overriding the layout page when returning ViewResults and fixes a bug in UsePhysicalViewsIfNewer&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1/8/2012&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Version 1.2.3 of the VSIX fixes MVC4 issue (http://razorgenerator.codeplex.com/workitem/26)&lt;/li&gt;
&lt;li&gt;Version 1.3.1 of RazorGenerator.Testing fixes an issue with RenderAsHtml not flowing the context&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.2 (8/29/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Renamed all packages to be RazorGenerator.*&lt;/li&gt;
&lt;li&gt;Fix issue http://razorgenerator.codeplex.com/workitem/22 (Line pragmas should not use absolute paths)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1.2 (8/4/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Fixed encoding issue when using ANSI (non UTF-8) razor files (&lt;a href="http://razorgenerator.codeplex.com/workitem/15"&gt;http://razorgenerator.codeplex.com/workitem/15&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Support null values in simple template scenario. e.g. @foo when foo is null now renders empty string. (&lt;a href="http://razorgenerator.codeplex.com/workitem/16"&gt;http://razorgenerator.codeplex.com/workitem/16&lt;/a&gt;)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1.1 (7/11/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Change the generated file extensions from foo.cs to foo.generated.cs (&lt;a href="http://razorgenerator.codeplex.com/workitem/8"&gt;http://razorgenerator.codeplex.com/workitem/8&lt;/a&gt;)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1 (7/7/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;The generator now finds imported namespaces defined in web.config&lt;/li&gt;
&lt;li&gt;Add support for project level directives in a razorgenerator.directives file&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.0.1 (6/21/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Fix generated line pragmas&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.0&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Original release&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Related blog posts:&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.davidebbo.com/search/label/RazorGenerator"&gt;http://blog.davidebbo.com/search/label/RazorGenerator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/b/davidebb/archive/2010/10/27/turn-your-razor-helpers-into-reusable-libraries.aspx"&gt;http://blogs.msdn.com/b/davidebb/archive/2010/10/27/turn-your-razor-helpers-into-reusable-libraries.aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>davidebbo</author><pubDate>Wed, 05 Sep 2012 17:58:15 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20120905055815P</guid></item><item><title>Updated Wiki: Home</title><link>http://razorgenerator.codeplex.com/wikipage?version=17</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;Razor Generator&lt;/h1&gt;
This is a Custom Tool for Visual Studio that allows processing Razor files at design time instead of runtime, allowing them to be built into an assembly for simpler reuse and distribution. &lt;br /&gt;&lt;br /&gt;Note that this tool currently only supports C#. VB support could probably be done if someone wants to help out with it!&lt;br /&gt;
&lt;h2&gt;Installation instructions&lt;/h2&gt;It’s on the VS extension gallery, so install it from there. It’s called “Razor Generator” (not to be confused with “Razor Single File Generator for MVC”).&lt;br /&gt;
&lt;h2&gt;Generator Types&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;MvcHelper&lt;/b&gt;: Creates a static type that is best suited for writing Mvc specific helper methods. &lt;/li&gt;
&lt;li&gt;&lt;b&gt;MvcView&lt;/b&gt;: Create a WebViewPage which allows the use of precompiled MVC views.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;WebPage&lt;/b&gt;: Creates a WebPage type that can be used as WebPages Application Part (such as _Admin and RazorDebugger).&lt;/li&gt;
&lt;li&gt;&lt;b&gt;WebPagesHelper&lt;/b&gt;: Creates a HelperPage type that is suited for precompiling and distributing WebPages helper.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Template&lt;/b&gt;: Generator based on T4 preprocessed template. &lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;
&lt;h2&gt;Usage in an MVC app&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;Install the &amp;#39;RazorGenerator.Mvc&amp;#39; package, which registers a special view engine&lt;/li&gt;
&lt;li&gt;Go to an MVC Razor view&amp;#39;s property and set the &lt;b&gt;Custom tool&lt;/b&gt; to &lt;b&gt;RazorGenerator&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Optionally specify a value for Custom Tool Namespace to specify a namespace for the generated file. The project namespace is used by default.&lt;/li&gt;
&lt;li&gt;Optionally specify one of the generators in the first line of your Razor file. A generator declaration line looks like this: &lt;span class="codeInline"&gt; @* Generator: MvcHelper *@ &lt;/span&gt;. If you don&amp;#39;t specify this, a generator is picked based on convention (e.g. files under Views are treated as MvcViews)&lt;/li&gt;
&lt;li&gt;You&amp;#39;ll see a generated .cs file under the .cshtml file, which will be used at runtime instead of the .cshtml file&lt;/li&gt;
&lt;li&gt;You can also go to the nuget Package Manager Console and run &amp;#39;Enable-RazorGenerator&amp;#39; to enable the Custom Tool on all the views.&lt;/li&gt;
&lt;li&gt;And to cause all the views to be regenerated, go to the nuget Package Manager Console and run &amp;#39;Redo-RazorGenerator&amp;#39;. This is useful when you update the generator package and it needs to generate different code.&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Usage in a View Library&lt;/h2&gt;
If you need to create a separate library for your precompiled MVC views, the best approach is to actually create an MVC project for that library, instead of a library project. You&amp;#39;ll never actually run it as an Mvc app, but the fact that it comes with the right set of config files allows intellisense and other things to work a lot better than in a library project.&lt;br /&gt;&lt;br /&gt;You can then add a reference to that &amp;#39;MVC View project&amp;#39; from your real MVC app.&lt;br /&gt;&lt;br /&gt;And note that you need to install the &amp;#39;RazorGenerator.Mvc&amp;#39; package into the library, not the main MVC app.&lt;br /&gt;&lt;br /&gt;See &lt;a href="https://github.com/davidebbo/MvcApplicationRazorGeneratorSeparateLibrary"&gt;https://github.com/davidebbo/MvcApplicationRazorGeneratorSeparateLibrary&lt;/a&gt; for a sample.&lt;br /&gt;&lt;br /&gt;
&lt;h2&gt;History&lt;/h2&gt;
&lt;h3&gt;4/20/2012&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Version 1.4 of RazorGenerator.Mvc issue with multiple registered view engines (http://razorgenerator.codeplex.com/workitem/55), adds support for overriding the layout page when returning ViewResults and fixes a bug in UsePhysicalViewsIfNewer&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1/8/2012&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Version 1.2.3 of the VSIX fixes MVC4 issue (http://razorgenerator.codeplex.com/workitem/26)&lt;/li&gt;
&lt;li&gt;Version 1.3.1 of RazorGenerator.Testing fixes an issue with RenderAsHtml not flowing the context&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.2 (8/29/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Renamed all packages to be RazorGenerator.*&lt;/li&gt;
&lt;li&gt;Fix issue http://razorgenerator.codeplex.com/workitem/22 (Line pragmas should not use absolute paths)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1.2 (8/4/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Fixed encoding issue when using ANSI (non UTF-8) razor files (&lt;a href="http://razorgenerator.codeplex.com/workitem/15"&gt;http://razorgenerator.codeplex.com/workitem/15&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Support null values in simple template scenario. e.g. @foo when foo is null now renders empty string. (&lt;a href="http://razorgenerator.codeplex.com/workitem/16"&gt;http://razorgenerator.codeplex.com/workitem/16&lt;/a&gt;)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1.1 (7/11/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Change the generated file extensions from foo.cs to foo.generated.cs (&lt;a href="http://razorgenerator.codeplex.com/workitem/8"&gt;http://razorgenerator.codeplex.com/workitem/8&lt;/a&gt;)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1 (7/7/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;The generator now finds imported namespaces defined in web.config&lt;/li&gt;
&lt;li&gt;Add support for project level directives in a razorgenerator.directives file&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.0.1 (6/21/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Fix generated line pragmas&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.0&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Original release&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Related blog posts:&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.davidebbo.com/search/label/RazorGenerator"&gt;http://blog.davidebbo.com/search/label/RazorGenerator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/b/davidebb/archive/2010/10/27/turn-your-razor-helpers-into-reusable-libraries.aspx"&gt;http://blogs.msdn.com/b/davidebb/archive/2010/10/27/turn-your-razor-helpers-into-reusable-libraries.aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>davidebbo</author><pubDate>Fri, 03 Aug 2012 00:27:53 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20120803122753A</guid></item><item><title>Updated Wiki: Home</title><link>http://razorgenerator.codeplex.com/wikipage?version=16</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;Razor Generator&lt;/h1&gt;
This is a Custom Tool for Visual Studio that allows processing Razor files at design time instead of runtime, allowing them to be built into an assembly for simpler reuse and distribution. &lt;br /&gt;
&lt;h2&gt;Installation instructions&lt;/h2&gt;It’s on the VS extension gallery, so install it from there. It’s called “Razor Generator” (not to be confused with “Razor Single File Generator for MVC”).&lt;br /&gt;
&lt;h2&gt;Generator Types&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;MvcHelper&lt;/b&gt;: Creates a static type that is best suited for writing Mvc specific helper methods. &lt;/li&gt;
&lt;li&gt;&lt;b&gt;MvcView&lt;/b&gt;: Create a WebViewPage which allows the use of precompiled MVC views.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;WebPage&lt;/b&gt;: Creates a WebPage type that can be used as WebPages Application Part (such as _Admin and RazorDebugger).&lt;/li&gt;
&lt;li&gt;&lt;b&gt;WebPagesHelper&lt;/b&gt;: Creates a HelperPage type that is suited for precompiling and distributing WebPages helper.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Template&lt;/b&gt;: Generator based on T4 preprocessed template. &lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;
&lt;h2&gt;Usage in an MVC app&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;Install the &amp;#39;RazorGenerator.Mvc&amp;#39; package, which registers a special view engine&lt;/li&gt;
&lt;li&gt;Go to an MVC Razor view&amp;#39;s property and set the &lt;b&gt;Custom tool&lt;/b&gt; to &lt;b&gt;RazorGenerator&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Optionally specify a value for Custom Tool Namespace to specify a namespace for the generated file. The project namespace is used by default.&lt;/li&gt;
&lt;li&gt;Optionally specify one of the generators in the first line of your Razor file. A generator declaration line looks like this: &lt;span class="codeInline"&gt; @* Generator: MvcHelper *@ &lt;/span&gt;. If you don&amp;#39;t specify this, a generator is picked based on convention (e.g. files under Views are treated as MvcViews)&lt;/li&gt;
&lt;li&gt;You&amp;#39;ll see a generated .cs file under the .cshtml file, which will be used at runtime instead of the .cshtml file&lt;/li&gt;
&lt;li&gt;You can also go to the nuget Package Manager Console and run &amp;#39;Enable-RazorGenerator&amp;#39; to enable the Custom Tool on all the views.&lt;/li&gt;
&lt;li&gt;And to cause all the views to be regenerated, go to the nuget Package Manager Console and run &amp;#39;Redo-RazorGenerator&amp;#39;. This is useful when you update the generator package and it needs to generate different code.&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Usage in a View Library&lt;/h2&gt;
If you need to create a separate library for your precompiled MVC views, the best approach is to actually create an MVC project for that library, instead of a library project. You&amp;#39;ll never actually run it as an Mvc app, but the fact that it comes with the right set of config files allows intellisense and other things to work a lot better than in a library project.&lt;br /&gt;&lt;br /&gt;You can then add a reference to that &amp;#39;MVC View project&amp;#39; from your real MVC app.&lt;br /&gt;&lt;br /&gt;And note that you need to install the &amp;#39;RazorGenerator.Mvc&amp;#39; package into the library, not the main MVC app.&lt;br /&gt;&lt;br /&gt;See &lt;a href="https://github.com/davidebbo/MvcApplicationRazorGeneratorSeparateLibrary"&gt;https://github.com/davidebbo/MvcApplicationRazorGeneratorSeparateLibrary&lt;/a&gt; for a sample.&lt;br /&gt;&lt;br /&gt;
&lt;h2&gt;History&lt;/h2&gt;
&lt;h3&gt;4/20/2012&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Version 1.4 of RazorGenerator.Mvc issue with multiple registered view engines (http://razorgenerator.codeplex.com/workitem/55), adds support for overriding the layout page when returning ViewResults and fixes a bug in UsePhysicalViewsIfNewer&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1/8/2012&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Version 1.2.3 of the VSIX fixes MVC4 issue (http://razorgenerator.codeplex.com/workitem/26)&lt;/li&gt;
&lt;li&gt;Version 1.3.1 of RazorGenerator.Testing fixes an issue with RenderAsHtml not flowing the context&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.2 (8/29/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Renamed all packages to be RazorGenerator.*&lt;/li&gt;
&lt;li&gt;Fix issue http://razorgenerator.codeplex.com/workitem/22 (Line pragmas should not use absolute paths)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1.2 (8/4/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Fixed encoding issue when using ANSI (non UTF-8) razor files (&lt;a href="http://razorgenerator.codeplex.com/workitem/15"&gt;http://razorgenerator.codeplex.com/workitem/15&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Support null values in simple template scenario. e.g. @foo when foo is null now renders empty string. (&lt;a href="http://razorgenerator.codeplex.com/workitem/16"&gt;http://razorgenerator.codeplex.com/workitem/16&lt;/a&gt;)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1.1 (7/11/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Change the generated file extensions from foo.cs to foo.generated.cs (&lt;a href="http://razorgenerator.codeplex.com/workitem/8"&gt;http://razorgenerator.codeplex.com/workitem/8&lt;/a&gt;)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1 (7/7/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;The generator now finds imported namespaces defined in web.config&lt;/li&gt;
&lt;li&gt;Add support for project level directives in a razorgenerator.directives file&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.0.1 (6/21/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Fix generated line pragmas&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.0&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Original release&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Related blog posts:&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.davidebbo.com/search/label/RazorGenerator"&gt;http://blog.davidebbo.com/search/label/RazorGenerator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/b/davidebb/archive/2010/10/27/turn-your-razor-helpers-into-reusable-libraries.aspx"&gt;http://blogs.msdn.com/b/davidebb/archive/2010/10/27/turn-your-razor-helpers-into-reusable-libraries.aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>pranavkm</author><pubDate>Fri, 20 Apr 2012 16:22:19 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20120420042219P</guid></item><item><title>Updated Wiki: Home</title><link>http://razorgenerator.codeplex.com/wikipage?version=15</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;Razor Generator&lt;/h1&gt;
This is a Custom Tool for Visual Studio that allows processing Razor files at design time instead of runtime, allowing them to be built into an assembly for simpler reuse and distribution. &lt;br /&gt;
&lt;h2&gt;Installation instructions&lt;/h2&gt;It’s on the VS extension gallery, so install it from there. It’s called “Razor Generator” (not to be confused with “Razor Single File Generator for MVC”).&lt;br /&gt;
&lt;h2&gt;Generator Types&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;MvcHelper&lt;/b&gt;: Creates a static type that is best suited for writing Mvc specific helper methods. &lt;/li&gt;
&lt;li&gt;&lt;b&gt;MvcView&lt;/b&gt;: Create a WebViewPage which allows the use of precompiled MVC views.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;WebPage&lt;/b&gt;: Creates a WebPage type that can be used as WebPages Application Part (such as _Admin and RazorDebugger).&lt;/li&gt;
&lt;li&gt;&lt;b&gt;WebPagesHelper&lt;/b&gt;: Creates a HelperPage type that is suited for precompiling and distributing WebPages helper.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Template&lt;/b&gt;: Generator based on T4 preprocessed template. &lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;
&lt;h2&gt;Usage in an MVC app&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;Install the &amp;#39;RazorGenerator.Mvc&amp;#39; package, which registers a special view engine&lt;/li&gt;
&lt;li&gt;Go to an MVC Razor view&amp;#39;s property and set the &lt;b&gt;Custom tool&lt;/b&gt; to &lt;b&gt;RazorGenerator&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Optionally specify a value for Custom Tool Namespace to specify a namespace for the generated file. The project namespace is used by default.&lt;/li&gt;
&lt;li&gt;Optionally specify one of the generators in the first line of your Razor file. A generator declaration line looks like this: &lt;span class="codeInline"&gt; @* Generator: MvcHelper *@ &lt;/span&gt;. If you don&amp;#39;t specify this, a generator is picked based on convention (e.g. files under Views are treated as MvcViews)&lt;/li&gt;
&lt;li&gt;You&amp;#39;ll see a generated .cs file under the .cshtml file, which will be used at runtime instead of the .cshtml file&lt;/li&gt;
&lt;li&gt;You can also go to the nuget Package Manager Console and run &amp;#39;Enable-RazorGenerator&amp;#39; to enable the Custom Tool on all the views.&lt;/li&gt;
&lt;li&gt;And to cause all the views to be regenerated, go to the nuget Package Manager Console and run &amp;#39;Redo-RazorGenerator&amp;#39;. This is useful when you update the generator package and it needs to generate different code.&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Usage in a View Library&lt;/h2&gt;
If you need to create a separate library for your precompiled MVC views, the best approach is to actually create an MVC project for that library, instead of a library project. You&amp;#39;ll never actually run it as an Mvc app, but the fact that it comes with the right set of config files allows intellisense and other things to work a lot better than in a library project.&lt;br /&gt;&lt;br /&gt;You can then add a reference to that &amp;#39;MVC View project&amp;#39; from your real MVC app.&lt;br /&gt;&lt;br /&gt;And note that you need to install the &amp;#39;RazorGenerator.Mvc&amp;#39; package into the library, not the main MVC app.&lt;br /&gt;&lt;br /&gt;See &lt;a href="https://github.com/davidebbo/MvcApplicationRazorGeneratorSeparateLibrary" class="externalLink"&gt;https://github.com/davidebbo/MvcApplicationRazorGeneratorSeparateLibrary&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for a sample.&lt;br /&gt;&lt;br /&gt;
&lt;h2&gt;History&lt;/h2&gt;
&lt;h3&gt;1/8/2012&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Version 1.2.3 of the VSIX fixes MVC4 issue (http://razorgenerator.codeplex.com/workitem/26)&lt;/li&gt;
&lt;li&gt;Version 1.3.1 of RazorGenerator.Testing fixes an issue with RenderAsHtml not flowing the context&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.2 (8/29/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Renamed all packages to be RazorGenerator.*&lt;/li&gt;
&lt;li&gt;Fix issue http://razorgenerator.codeplex.com/workitem/22 (Line pragmas should not use absolute paths)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1.2 (8/4/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Fixed encoding issue when using ANSI (non UTF-8) razor files (&lt;a href="http://razorgenerator.codeplex.com/workitem/15" class="externalLink"&gt;http://razorgenerator.codeplex.com/workitem/15&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Support null values in simple template scenario. e.g. @foo when foo is null now renders empty string. (&lt;a href="http://razorgenerator.codeplex.com/workitem/16" class="externalLink"&gt;http://razorgenerator.codeplex.com/workitem/16&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1.1 (7/11/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Change the generated file extensions from foo.cs to foo.generated.cs (&lt;a href="http://razorgenerator.codeplex.com/workitem/8" class="externalLink"&gt;http://razorgenerator.codeplex.com/workitem/8&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;)&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.1 (7/7/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;The generator now finds imported namespaces defined in web.config&lt;/li&gt;
&lt;li&gt;Add support for project level directives in a razorgenerator.directives file&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.0.1 (6/21/2011)&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Fix generated line pragmas&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;1.0&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Original release&lt;/li&gt;&lt;/ul&gt;

&lt;h2&gt;Related blog posts:&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://blog.davidebbo.com/search/label/RazorGenerator" class="externalLink"&gt;http://blog.davidebbo.com/search/label/RazorGenerator&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/b/davidebb/archive/2010/10/27/turn-your-razor-helpers-into-reusable-libraries.aspx" class="externalLink"&gt;http://blogs.msdn.com/b/davidebb/archive/2010/10/27/turn-your-razor-helpers-into-reusable-libraries.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>davidebbo</author><pubDate>Wed, 07 Mar 2012 17:33:04 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20120307053304P</guid></item></channel></rss>