本文整理汇总了C#中System.CodeDom.Compiler.CompilerParameters.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# CompilerParameters.ToString方法的具体用法?C# CompilerParameters.ToString怎么用?C# CompilerParameters.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.CodeDom.Compiler.CompilerParameters
的用法示例。
在下文中一共展示了CompilerParameters.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompileAssemblyFromFileBatch
public CompilerResults CompileAssemblyFromFileBatch(CompilerParameters options, string[] fileNames)
{
//System.Diagnostics.Debug.Assert(false);
foreach (string file in fileNames)
if (file.ToLower().EndsWith(".xaml"))
return CompileAssemblyFromFileBatchImpl(options, fileNames);
if (options.ToString() == "" || options == null)
return new CSharpCodeProvider().CreateCompiler().CompileAssemblyFromFileBatch(options, fileNames);
else
return new CSharpCodeProvider(new Dictionary<string, string>() { { "CompilerVersion", options.ToString() } }).CreateCompiler().CompileAssemblyFromFileBatch(options, fileNames);
}
示例2: CompileAssemblyFromFileBatch
public CompilerResults CompileAssemblyFromFileBatch(CompilerParameters options, string[] fileNames)
{
string tempFile;
ArrayList classlessFiles = new ArrayList();
ArrayList files = new ArrayList();
int count = 0;
CCSharpParser ccs;
foreach (string file in fileNames)
{
ccs = new CCSharpParser(file);
if (!ccs.isClassless)
{
files.Add(file);
}
else
{
tempFile = ccs.ToTempFile(count > 0 );
classlessFiles.Add(tempFile);
files.Add(tempFile);
}
count++;
}
Microsoft.CSharp.CSharpCodeProvider provider;
if (options.ToString() == "" || options == null)
return new Microsoft.CSharp.CSharpCodeProvider().CreateCompiler().CompileAssemblyFromFileBatch(options, fileNames);
else
return new Microsoft.CSharp.CSharpCodeProvider(new Dictionary<string, string>() { { "CompilerVersion", options.ToString() } }).CreateCompiler().CompileAssemblyFromFileBatch(options, fileNames);
CompilerResults retval;
retval = provider.CreateCompiler().CompileAssemblyFromFileBatch(options, (string[])files.ToArray(typeof(string)));
if (!retval.Errors.HasErrors)
foreach (string file in classlessFiles)
try
{
File.Delete(file);
}
catch{}
return retval;
}
示例3: CompilationException
public CompilationException(
CodeDomProvider provider,
CompilerParameters parameters,
CompilerResults results,
params String[] sources
)
{
StringWriter sw = new StringWriter();
sw.WriteLine("Compilation: {0} errors", results.Errors.Count);
sw.WriteLine("Compiler: {0}", provider.FileExtension);
sw.WriteLine("CompilerParameters: {0}", parameters.ToString());
foreach (CompilerError error in results.Errors)
{
sw.WriteLine(error.ToString());
}
sw.WriteLine("Sources:");
foreach (string source in sources)
sw.WriteLine(source);
this.body = sw.ToString();
}
示例4: CompilationException
public CompilationException(
ICodeCompiler compiler,
CompilerParameters parameters,
CompilerResults results,
params String[] sources
)
{
StringWriter sw = new StringWriter();
sw.WriteLine("Compilation: {0} errors",results.Errors.Count);
sw.WriteLine("Compiler: {0}",compiler.GetType().Name);
sw.WriteLine("CompilerParameters: {0}",parameters.ToString());
foreach(CompilerError error in results.Errors)
{
sw.WriteLine(error.ToString());
}
sw.WriteLine("Sources:");
foreach(string source in sources)
sw.WriteLine(source);
this.message =sw.ToString();
}