I am producing some HTML content for the share charm in WinRT. So I need to precompile the cshtml to .cs in my WinRT project. I'm not entirely clear over the entire process that needs to be used here, but as I understand it I need to install
the RazorGenerator visual studio extension. Unfortunately I can only install that into visual studio 2010?
How do I get it installed into visual studio 2011, so that I can select a custom tool of RazorGenerator?
Secondly RazorGenerator.Templating isn't able to be installed in a WinRT project. So I decompiled the class and I can build that class, but there are some changes required in the write function. It should look like this:
public void Write(object value)
if (value == null)
MethodInfo method = null;
var methods = value.GetType().GetTypeInfo().GetDeclaredMethods("ToString");
if (methods != null)
foreach (MethodInfo methodInfo in methods)
if (methodInfo.GetParameters().Count() == 1 && methodInfo.GetParameters().ParameterType == typeof (IFormatProvider))
method = methodInfo;
MethodInfo method = value.GetType().GetMethod("ToString", new Type
if (method == (MethodInfo)null)
textToAppend = value.ToString();
textToAppend = (string)method.Invoke(value, new object
And then it works fine. Hopefully a WinRT specific version of the nuget project can be built at some point, but in the meantime if I include that class myself, I will be fine. Is just a matter of getting the razor generator functioning. Hope
someone is able to help with that.