public static Compile ( string source, bool targetCSharp6 = false ) : |
||
source | string | The source. |
targetCSharp6 | bool | |
Résultat |
private static bool Compile(string tempFile) { var results = CSharpTestFile.Compile(File.ReadAllText(tempFile), true); if (results.Errors.Count > 0) { CompilerError error = null; error = TestUtilities.GetCompilerError(results); if (error != null) { string messageFormat = "Test source code should not produce compiler errors. " + "Error: {0} - {1}, line {2}, column {3} "; Assert.Fail( messageFormat, error.ErrorText, tempFile, error.Line, error.Column); } return(false); } return(true); }
/// <summary> /// Compiles source code text to the specified assembly. /// </summary> /// <param name="text">Text to compile.</param> /// <param name="assemblyName">Output assembly name.</param> /// <returns>Compiler results.</returns> protected override CompilerResults Compile(string text, string assemblyName) { return(CSharpTestFile.Compile(text, assemblyName)); }