当前位置: 首页>>代码示例>>C#>>正文


C# CompilationOptions类代码示例

本文整理汇总了C#中CompilationOptions的典型用法代码示例。如果您正苦于以下问题:C# CompilationOptions类的具体用法?C# CompilationOptions怎么用?C# CompilationOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CompilationOptions类属于命名空间,在下文中一共展示了CompilationOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleCommandLineArgs

        private static bool HandleCommandLineArgs(string[] args)
        {
            bool status = true;
            options = new OptionSet
                          {
                              {"d", "Debug mode", v => option_compilationOptions |= CompilationOptions.DebugMode},
                              {"l|language=", "Custom language", v => option_customLanguage = v},
                              {"?|h|help", "Show help", v => { status = false; }},
                              {"<>", v => option_filename = v}
                          };
            try
            {
                options.Parse(args);
            }
            catch (OptionException)
            {
                status = false;
            }

            if (String.IsNullOrEmpty(option_filename))
            {
                status = false;
            }

            return status;
        }
开发者ID:dreasgrech,项目名称:yabfcompiler,代码行数:26,代码来源:Program.cs

示例2: CreateAsync

 public static async Task<ExtractInterfaceTestState> CreateAsync(string markup, string languageName, CompilationOptions compilationOptions)
 {
     var workspace = languageName == LanguageNames.CSharp
         ? await TestWorkspace.CreateCSharpAsync(markup, exportProvider: ExportProvider, compilationOptions: compilationOptions as CSharpCompilationOptions)
         : await TestWorkspace.CreateVisualBasicAsync(markup, exportProvider: ExportProvider, compilationOptions: compilationOptions);
     return new ExtractInterfaceTestState(workspace);
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:7,代码来源:ExtractInterfaceTestState.cs

示例3: CompileAndVerify

        internal CompilationVerifier CompileAndVerify(
            string[] sources,
            IEnumerable<MetadataReference> additionalRefs = null,
            IEnumerable<ModuleData> dependencies = null,
            Action<IModuleSymbol> sourceSymbolValidator = null,
            Action<PEAssembly> assemblyValidator = null,
            Action<IModuleSymbol> symbolValidator = null,
            SignatureDescription[] expectedSignatures = null,
            string expectedOutput = null,
            CompilationOptions options = null,
            ParseOptions parseOptions = null,
            bool verify = true)
        {
            if (options == null)
            {
                options = CompilationOptionsReleaseDll.WithOutputKind((expectedOutput != null) ? OutputKind.ConsoleApplication : OutputKind.DynamicallyLinkedLibrary);
            }

            var compilation = GetCompilationForEmit(sources, additionalRefs, options, parseOptions);

            return this.CompileAndVerify(
                compilation,
                null,
                dependencies,
                sourceSymbolValidator,
                assemblyValidator,
                symbolValidator,
                expectedSignatures,
                expectedOutput,
                verify);
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:31,代码来源:CommonTestBase.cs

示例4: CodeCompilationIsCorrect

        public virtual void CodeCompilationIsCorrect()
        {
            // Arrange
            string inputFilePath = Path.Combine(_resourcesDirectoryPath,
                string.Format("variables/{0}/style{1}", _subfolderName, _fileExtension));
            string outputFilePath = Path.Combine(_resourcesDirectoryPath, "variables/style.css");

            string inputCode = File.ReadAllText(inputFilePath);
            string targetOutputCode = File.ReadAllText(outputFilePath);

            var options = new CompilationOptions
            {
                IndentedSyntax = _indentedSyntax
            };

            // Act
            CompilationResult result;

            using (var compiler = new SassCompiler())
            {
                result = compiler.Compile(inputCode, options: options);
            }

            // Assert
            Assert.Equal(targetOutputCode, result.CompiledContent);
            Assert.True(string.IsNullOrEmpty(result.SourceMap));
            Assert.Empty(result.IncludedFilePaths);
        }
开发者ID:Taritsyn,项目名称:LibSassHost,代码行数:28,代码来源:CompileTestsBase.cs

示例5: CreateWorkspaceFromFiles

 /// <param name="files">Can pass in multiple file contents: files will be named test1.cs, test2.cs, etc.</param>
 internal static TestWorkspace CreateWorkspaceFromFiles(
     string language,
     CompilationOptions compilationOptions,
     ParseOptions parseOptions,
     params string[] files)
 {
     return CreateWorkspaceFromFiles(language, compilationOptions, parseOptions, files, exportProvider: null);
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:9,代码来源:TestWorkspaceFactory.cs

示例6:

 Compilation ICompilationFactoryService.CreateSubmissionCompilation(string assemblyName, CompilationOptions options, Type hostObjectType)
 {
     return CSharpCompilation.CreateScriptCompilation(
         assemblyName,
         options: (CSharpCompilationOptions)options,
         previousScriptCompilation: null,
         globalsType: hostObjectType);
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:8,代码来源:CSharpCompilationFactoryService.cs

示例7: WriteTo

        public override void WriteTo(CompilationOptions options, ObjectWriter writer, CancellationToken cancellationToken)
        {
            WriteCompilationOptionsTo(options, writer, cancellationToken);

            var csharpOptions = (CSharpCompilationOptions)options;
            writer.WriteValue(csharpOptions.Usings.ToArray());
            writer.WriteBoolean(csharpOptions.AllowUnsafe);
        }
开发者ID:jkotas,项目名称:roslyn,代码行数:8,代码来源:CSharpOptionsSerializationService.cs

示例8: CreateAsync

 /// <param name="files">Can pass in multiple file contents: files will be named test1.cs, test2.cs, etc.</param>
 internal static Task<TestWorkspace> CreateAsync(
     string language,
     CompilationOptions compilationOptions,
     ParseOptions parseOptions,
     params string[] files)
 {
     return CreateAsync(language, compilationOptions, parseOptions, files, exportProvider: null);
 }
开发者ID:peter76111,项目名称:roslyn,代码行数:9,代码来源:TestWorkspace_Create.cs

示例9: CreateWorkspaceFromFileAsync

 /// <summary>
 /// Creates a single buffer in a workspace.
 /// </summary>
 /// <param name="content">Lines of text, the buffer contents</param>
 internal static Task<TestWorkspace> CreateWorkspaceFromFileAsync(
     string language,
     CompilationOptions compilationOptions,
     ParseOptions parseOptions,
     string content)
 {
     return CreateWorkspaceFromFilesAsync(language, compilationOptions, parseOptions, new[] { content });
 }
开发者ID:TerabyteX,项目名称:roslyn,代码行数:12,代码来源:TestWorkspaceFactory.cs

示例10: CreateWorkspaceFromFileAsync

 protected override async Task<TestWorkspace> CreateWorkspaceFromFileAsync(string definition, ParseOptions parseOptions, CompilationOptions compilationOptions)
 {
     var workspace = await base.CreateWorkspaceFromFileAsync(definition, parseOptions, compilationOptions);
     workspace.Options = workspace.Options
         .WithChangedOption(AddImportOptions.SuggestForTypesInNuGetPackages, LanguageNames.CSharp, true)
         .WithChangedOption(AddImportOptions.SuggestForTypesInReferenceAssemblies, LanguageNames.CSharp, true);
     return workspace;
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:8,代码来源:AddUsingTests_NuGet.cs

示例11: CreateWorkspaceFromFilesAsync

 /// <param name="files">Can pass in multiple file contents with individual source kind: files will be named test1.vb, test2.vbx, etc.</param>
 public static Task<TestWorkspace> CreateWorkspaceFromFilesAsync(
     string[] files,
     ParseOptions[] parseOptions = null,
     CompilationOptions compilationOptions = null,
     ExportProvider exportProvider = null)
 {
     return TestWorkspaceFactory.CreateWorkspaceFromFilesAsync(LanguageNames.VisualBasic, compilationOptions, parseOptions, files, exportProvider);
 }
开发者ID:TerabyteX,项目名称:roslyn,代码行数:9,代码来源:VisualBasicWorkspaceFactory.cs

示例12: CreateWorkspaceFromFileAsync

 public static Task<TestWorkspace> CreateWorkspaceFromFileAsync(
     string file,
     ParseOptions parseOptions = null,
     CompilationOptions compilationOptions = null,
     ExportProvider exportProvider = null,
     string[] metadataReferences = null)
 {
     return CreateWorkspaceFromFilesAsync(new[] { file }, parseOptions, compilationOptions, exportProvider, metadataReferences);
 }
开发者ID:TerabyteX,项目名称:roslyn,代码行数:9,代码来源:VisualBasicWorkspaceFactory.cs

示例13: CreateWorkspaceFromLines

 /// <summary>
 /// Creates a single buffer in a workspace.
 /// </summary>
 /// <param name="content">Lines of text, the buffer contents</param>
 internal static TestWorkspace CreateWorkspaceFromLines(
     string language,
     CompilationOptions compilationOptions,
     ParseOptions parseOptions,
     params string[] content)
 {
     var total = content.Join(Environment.NewLine);
     return CreateWorkspaceFromFiles(language, compilationOptions, parseOptions, total);
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:13,代码来源:TestWorkspaceFactory.cs

示例14: Compile_Synchronous

        /// <summary>
        ///     Performs a synchronous compilation
        /// </summary>
        /// <param name="rebuild"></param>
        /// <param name="silent"></param>
        public void Compile_Synchronous(bool rebuild, bool silent = false)
        {
            Options = new CompilationOptions (rebuild, silent);
            ModelElement.DontRaiseError(Options.SilentCompile, () =>
            {
                try
                {
                    // Clears all caches
                    FinderRepository.INSTANCE.ClearCache();

                    // Initialises the declared elements
                    // ReSharper disable once UnusedVariable
                    CleanBeforeCompilation clean_before_compilation = new CleanBeforeCompilation(Options, true);

                    // Create the update information
                    // ReSharper disable once UnusedVariable
                    FindUpdates find_updates = new FindUpdates();

                    // Unifies the state machines and structure according to the update information
                    // ReSharper disable once UnusedVariable
                    Unify unify = new Unify();

                    // Compiles each expression and each statement encountered in the nodes
                    foreach (Dictionary dictionary in EfsSystem.Instance.Dictionaries)
                    {
                        visit(dictionary, true);
                    }

                    if (Options.Rebuild)
                    {
                        CreateDependancy create_dependancy = new CreateDependancy();
                        if (create_dependancy.DependancyChange)
                        {
                            // ReSharper disable once UnusedVariable
                            FlattenDependancy flatten_dependancy = new FlattenDependancy();
                        }
                    }
                }
                catch (ThreadAbortException)
                {
                    EfsSystem.Instance.ShouldRebuild = true;
                }
                catch (Exception e)
                {
                    // TODO : I don't know what to do.
                    // Please, at least, don't remove this
                    Debugger.Break();
                    Console.WriteLine();
                    Console.WriteLine(e.Message);
                    Console.WriteLine(e.StackTrace);
                    Console.WriteLine();
                    EfsSystem.Instance.ShouldRebuild = true;
                }
            });
        }
开发者ID:GautierBerck,项目名称:ERTMSFormalSpecs,代码行数:60,代码来源:Compiler.cs

示例15: SerializeCompilationOptions

        public void SerializeCompilationOptions(CompilationOptions options, ObjectWriter writer, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            var language = options.Language;

            // TODO: once compiler team adds ability to serialize compilation options to ObjectWriter directly, we won't need this.
            writer.WriteString(language);

            var service = GetOptionsSerializationService(language);
            service.WriteTo(options, writer, cancellationToken);
        }
开发者ID:jkotas,项目名称:roslyn,代码行数:12,代码来源:Serializer_Asset.cs


注:本文中的CompilationOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。