本文整理汇总了C#中Tests.Options.CompilerOptions方法的典型用法代码示例。如果您正苦于以下问题:C# Options.CompilerOptions方法的具体用法?C# Options.CompilerOptions怎么用?C# Options.CompilerOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tests.Options
的用法示例。
在下文中一共展示了Options.CompilerOptions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Build
internal static string Build(Options options, string extraCompilerOptions, Output output, out string absoluteSourceDir)
{
var sourceFile = options.MakeAbsolute(options.SourceFile);
var compilerpath = options.MakeAbsolute(Path.Combine(ToolsRoot, options.BuildFramework, options.Compiler));
var contractreferencedir = options.MakeAbsolute(Path.Combine(ContractReferenceDirRoot, options.BuildFramework));
var sourcedir = absoluteSourceDir = Path.GetDirectoryName(sourceFile);
var outputdir = Path.Combine(sourcedir, "bin", options.BuildFramework);
var extension = options.UseExe ? ".exe" : ".dll";
var targetKind = options.UseExe ? "exe" : "library";
var suffix = "_" + options.TestInstance;
if (options.GenerateUniqueOutputName)
suffix += "." + randGenerator.Next(0x10000).ToString("X4"); // enables concurrent tests on the same source file
var targetfile = Path.Combine(outputdir, Path.GetFileNameWithoutExtension(sourceFile) + suffix + extension);
// add Microsoft.Contracts reference if needed
if (!options.BuildFramework.Contains("v4."))
{
options.References.Add("Microsoft.Contracts.dll");
}
// MB: do not modify the CurrentDirectory, that could cause parallel tests to fail
var resolvedReferences = ResolveReferences(options);
var referenceString = ReferenceOptions(resolvedReferences);
if (!Directory.Exists(outputdir))
{
Directory.CreateDirectory(outputdir);
}
var args = String.Format("/debug /t:{4} /out:{0} {5} {3} {2} {1}", targetfile, sourceFile, referenceString, options.CompilerOptions(resolvedReferences), targetKind, extraCompilerOptions);
var exitCode = RunProcess(sourcedir, compilerpath, args, output);
if (exitCode != 0)
{
return null;
}
//CopyReferenceAssemblies(resolvedReferences, outputdir);
return targetfile;
}