本文整理汇总了C#中CompilerOptions.Validate方法的典型用法代码示例。如果您正苦于以下问题:C# CompilerOptions.Validate方法的具体用法?C# CompilerOptions.Validate怎么用?C# CompilerOptions.Validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CompilerOptions
的用法示例。
在下文中一共展示了CompilerOptions.Validate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Compile
private bool Compile() {
CompilerOptions options = new CompilerOptions();
options.DebugFlavor = DebugFlavor;
if (DebugFlavor) {
options.IncludeTests = IncludeTests;
}
else {
options.Minimize = Minimize;
}
options.Defines = GetDefines();
options.References = GetReferences();
options.Sources = GetSources(_sources);
options.Resources = GetResources(_resources);
if (_template != null) {
options.TemplateFile = new TaskItemInputStreamSource(_template, "Template");
}
if (_docCommentFile != null) {
options.DocCommentFile = new TaskItemInputStreamSource(_docCommentFile, "DocComment");
}
ITaskItem scriptTaskItem = new TaskItem(OutputPath);
options.ScriptFile = new TaskItemOutputStreamSource(scriptTaskItem);
string errorMessage = String.Empty;
if (options.Validate(out errorMessage) == false) {
Log.LogError(errorMessage);
return false;
}
ScriptCompiler compiler = new ScriptCompiler(this);
compiler.Compile(options);
if (_hasErrors == false) {
_script = scriptTaskItem;
string projectName = (_projectPath != null) ? Path.GetFileNameWithoutExtension(_projectPath) : String.Empty;
string scriptFileName = Path.GetFileName(scriptTaskItem.ItemSpec);
string scriptPath = Path.GetFullPath(scriptTaskItem.ItemSpec);
Log.LogMessage(MessageImportance.High, "{0} -> {1} ({2})", projectName, scriptFileName, scriptPath);
}
else {
return false;
}
return true;
}