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


C# CSharpParseOptions.WithKind方法代码示例

本文整理汇总了C#中CSharpParseOptions.WithKind方法的典型用法代码示例。如果您正苦于以下问题:C# CSharpParseOptions.WithKind方法的具体用法?C# CSharpParseOptions.WithKind怎么用?C# CSharpParseOptions.WithKind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSharpParseOptions的用法示例。


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

示例1: Parse


//.........这里部分代码省略.........
            ImmutableArray<string> referencePaths = BuildSearchPaths(sdkDirectory, libPaths);

            ValidateWin32Settings(win32ResourceFile, win32IconFile, win32ManifestFile, outputKind, diagnostics);

            // Dev11 searches for the key file in the current directory and assembly output directory.
            // We always look to base directory and then examine the search paths.
            keyFileSearchPaths.Add(baseDirectory);
            if (baseDirectory != outputDirectory)
            {
                keyFileSearchPaths.Add(outputDirectory);
            }

            if (!emitPdb)
            {
                if (pdbPath != null)
                {
                    // Can't give a PDB file name and turn off debug information
                    AddDiagnostic(diagnostics, ErrorCode.ERR_MissingDebugSwitch);
                }
            }

            string compilationName;
            GetCompilationAndModuleNames(diagnostics, outputKind, sourceFiles, sourceFilesSpecified, moduleAssemblyName, ref outputFileName, ref moduleName, out compilationName);

            var parseOptions = new CSharpParseOptions
            (
                languageVersion: languageVersion,
                preprocessorSymbols: defines.ToImmutableAndFree(),
                documentationMode: parseDocumentationComments ? DocumentationMode.Diagnose : DocumentationMode.None,
                kind: SourceCodeKind.Regular,
                features: CompilerOptionParseUtilities.ParseFeatures(features)
            );

            var scriptParseOptions = parseOptions.WithKind(SourceCodeKind.Script);

            var options = new CSharpCompilationOptions
            (
                outputKind: outputKind,
                moduleName: moduleName,
                mainTypeName: mainTypeName,
                scriptClassName: WellKnownMemberNames.DefaultScriptClassName,
                usings: usings,
                optimizationLevel: optimize ? OptimizationLevel.Release : OptimizationLevel.Debug,
                checkOverflow: checkOverflow,
                allowUnsafe: allowUnsafe,
                concurrentBuild: concurrentBuild,
                cryptoKeyContainer: keyContainerSetting,
                cryptoKeyFile: keyFileSetting,
                delaySign: delaySignSetting,
                platform: platform,
                generalDiagnosticOption: generalDiagnosticOption,
                warningLevel: warningLevel,
                specificDiagnosticOptions: diagnosticOptions
            );

            var emitOptions = new EmitOptions
            (
                metadataOnly: false,
                debugInformationFormat: DebugInformationFormat.Pdb,
                pdbFilePath: null, // to be determined later
                outputNameOverride: null, // to be determined later
                baseAddress: baseAddress,
                highEntropyVirtualAddressSpace: highEntropyVA,
                fileAlignment: fileAlignment,
                subsystemVersion: subsystemVersion,
                runtimeMetadataVersion: runtimeMetadataVersion
开发者ID:LunicLynx,项目名称:roslyn,代码行数:67,代码来源:CommandLineParser.cs


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