Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Libraries/Westwind.RazorHosting.dll
Binary file not shown.
5 changes: 5 additions & 0 deletions Libraries/Westwind.RazorHosting.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 17 additions & 7 deletions Westwind.RazorHosting/Core/RazorEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -489,13 +489,7 @@ public string CompileTemplate(
LastGeneratedCode = writer.ToString();
}

var compilerParameters = new CompilerParameters(ReferencedAssemblies.ToArray());
//compilerParameters.IncludeDebugInformation = true;
compilerParameters.GenerateInMemory = Configuration.CompileToMemory;


if (!Configuration.CompileToMemory)
compilerParameters.OutputAssembly = Path.Combine(Configuration.TempAssemblyPath, "_" + Guid.NewGuid().ToString("n") + ".dll");
var compilerParameters = CreateCompilerParameters();

CompilerResults compilerResults = codeProvider.CompileAssemblyFromDom(compilerParameters, razorResults.GeneratedCode);
if (compilerResults.Errors.Count > 0)
Expand Down Expand Up @@ -735,6 +729,22 @@ public void SetError()
}

public Exception LastException { get; set; }


protected virtual CompilerParameters CreateCompilerParameters()
{
var compilerParameters = new CompilerParameters(ReferencedAssemblies.ToArray());
//compilerParameters.IncludeDebugInformation = true;
compilerParameters.GenerateInMemory = Configuration.CompileToMemory;

if (!Configuration.CompileToMemory)
compilerParameters.OutputAssembly = Path.Combine(Configuration.TempAssemblyPath, "_" + Guid.NewGuid().ToString("n") + ".dll");

if (Configuration.TempFiles != null)
compilerParameters.TempFiles = Configuration.TempFiles;

return compilerParameters;
}
}

public enum CodeProvider
Expand Down
7 changes: 5 additions & 2 deletions Westwind.RazorHosting/Core/RazorEngineConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
using System;
using System.Text;
using System.IO;
using System.CodeDom.Compiler;

namespace Westwind.RazorHosting
{
Expand Down Expand Up @@ -88,8 +89,10 @@ public int StreamBufferSize
}
private int _StreamBufferSize = 2048;



/// <summary>
/// Specifies %Temp% folder for compiling files
/// </summary>
public TempFileCollection TempFiles { get; set; }
}

}