Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
RazorEngine Test
#Require PSNuGet<>
Use-NuGetPackage RazorEngine -Version 3.6.6 -Verbose
# テンプレート
$template = @'
Hello @Model.Name! Welcome to Razor!
@if (Model.ShowDetail) {
@:Plain Text!! はろー
@foreach (var item in Model.Array) {
@:Item value: @item => @item
# モデル
$model = [pscustomobject] @{
Name = "F#hoge"
ShowDetail = $true
Array = @(1; 2; 3;)
$cacheKey = "TestTemplate"
[RazorEngine.Razor]::Compile($template, $cacheKey)
[RazorEngine.Razor]::Parse($template, $model, $cacheKey)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.