當前位置: 首頁>>代碼示例>>C#>>正文


C# CodeAnalysis.CompilationOptions類代碼示例

本文整理匯總了C#中Microsoft.CodeAnalysis.CompilationOptions的典型用法代碼示例。如果您正苦於以下問題:C# CompilationOptions類的具體用法?C# CompilationOptions怎麽用?C# CompilationOptions使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CompilationOptions類屬於Microsoft.CodeAnalysis命名空間,在下文中一共展示了CompilationOptions類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CommonGetObjectData

 protected static void CommonGetObjectData(CompilationOptions options, SerializationInfo info, StreamingContext context)
 {
     info.AddValue(OutputKindString, (int)options.OutputKind);
     info.AddValue(ModuleNameString, options.ModuleName);
     info.AddValue(MainTypeNameString, options.MainTypeName);
     info.AddValue(ScriptClassNameString, options.ScriptClassName);
     info.AddValue(CryptoKeyContainerString, options.CryptoKeyContainer);
     info.AddValue(CryptoKeyFileString, options.CryptoKeyFile);
     info.AddValue(DelaySignString, options.DelaySign);
     info.AddValue(CheckOverflowString, options.CheckOverflow);
     info.AddValue(FileAlignmentString, options.FileAlignment);
     info.AddValue(BaseAddressString, options.BaseAddress);
     info.AddValue(PlatformString, (int)options.Platform);
     info.AddValue(GeneralDiagnosticOptionString, (int)options.GeneralDiagnosticOption);
     info.AddValue(WarningLevelString, options.WarningLevel);
     info.AddValue(SpecificDiagnosticOptionsString, new Dictionary<string, ReportDiagnostic>(options.SpecificDiagnosticOptions));
     info.AddValue(HighEntropyVirtualAddressSpaceString, options.HighEntropyVirtualAddressSpace);
     info.AddValue(DebugInformationKindString, (int)options.DebugInformationKind);
     info.AddValue(OptimizeString, options.Optimize);
     info.AddValue(SubsystemVersionMajorString, options.SubsystemVersion.Major);
     info.AddValue(SubsystemVersionMinorString, options.SubsystemVersion.Minor);
     info.AddValue(ConcurrentBuildString, options.ConcurrentBuild);
     info.AddValue(MetadataImportOptionsString, (byte)options.MetadataImportOptions);
     info.AddValue(FeaturesString, options.Features.ToArray());
 }
開發者ID:EkardNT,項目名稱:Roslyn,代碼行數:25,代碼來源:SerializableCompilationOptions.cs

示例2: SetOptionsCore

 private void SetOptionsCore(CompilationOptions newCompilationOptions)
 {
     lock (_gate)
     {
         _currentCompilationOptions = newCompilationOptions;
     }
 }
開發者ID:jkotas,項目名稱:roslyn,代碼行數:7,代碼來源:AbstractProject_Options.cs

示例3: TestHostSolution

 public TestHostSolution(
     HostLanguageServices languageServiceProvider,
     CompilationOptions compilationOptions,
     ParseOptions parseOptions,
     params MetadataReference[] references)
     : this(new TestHostProject(languageServiceProvider, compilationOptions, parseOptions, references))
 {
 }
開發者ID:Rickinio,項目名稱:roslyn,代碼行數:8,代碼來源:TestHostSolution.cs

示例4: 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:SoumikMukherjeeDOTNET,項目名稱:roslyn,代碼行數:9,代碼來源:VisualBasicWorkspaceFactory.cs

示例5: CreateWorkspaceFromFiles

 /// <param name="files">Can pass in multiple file contents: files will be named test1.vb, test2.vb, etc. and additional metadata references</param>
 public static TestWorkspace CreateWorkspaceFromFiles(
     string[] files,
     ParseOptions parseOptions = null,
     CompilationOptions compilationOptions = null,
     ExportProvider exportProvider = null,
     string[] metadataReferences = null)
 {
     return TestWorkspaceFactory.CreateWorkspaceFromFiles(LanguageNames.VisualBasic, compilationOptions, parseOptions, files, exportProvider, metadataReferences);
 }
開發者ID:GloryChou,項目名稱:roslyn,代碼行數:10,代碼來源:VisualBasicWorkspaceFactory.cs

示例6: 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:SoumikMukherjeeDOTNET,項目名稱:roslyn,代碼行數:9,代碼來源:VisualBasicWorkspaceFactory.cs

示例7: TestMissing

 protected void TestMissing(
     string initialMarkup,
     ParseOptions parseOptions,
     CompilationOptions compilationOptions,
     Func<dynamic, dynamic> nodeLocator = null)
 {
     using (var workspace = CreateWorkspaceFromFile(initialMarkup, parseOptions, compilationOptions))
     {
         var codeIssueOrRefactoring = GetCodeRefactoring(workspace, nodeLocator);
         Assert.Null(codeIssueOrRefactoring);
     }
 }
開發者ID:GloryChou,項目名稱:roslyn,代碼行數:12,代碼來源:AbstractCodeActionTest.cs

示例8: SetOptions

        /// <summary>
        /// Sets the given compilation and parse options.
        /// </summary>
        protected void SetOptions(CompilationOptions newCompilationOptions, ParseOptions newParseOptions)
        {
            this.UpdateRuleSetError(this.RuleSetFile);

            // Set options.
            CurrentCompilationOptions = newCompilationOptions;
            CurrentParseOptions = newParseOptions;

            if (_pushingChangesToWorkspaceHosts)
            {
                this.ProjectTracker.NotifyWorkspaceHosts(host => host.OnOptionsChanged(Id, newCompilationOptions, newParseOptions));
            }
        }
開發者ID:Rickinio,項目名稱:roslyn,代碼行數:16,代碼來源:AbstractProject_Options.cs

示例9: CommonGetObjectData

 protected static void CommonGetObjectData(CompilationOptions options, SerializationInfo info, StreamingContext context)
 {
     info.AddValue(OutputKindString, (int)options.OutputKind);
     info.AddValue(ModuleNameString, options.ModuleName);
     info.AddValue(MainTypeNameString, options.MainTypeName);
     info.AddValue(ScriptClassNameString, options.ScriptClassName);
     info.AddValue(CryptoKeyContainerString, options.CryptoKeyContainer);
     info.AddValue(CryptoKeyFileString, options.CryptoKeyFile);
     info.AddValue(DelaySignString, options.DelaySign);
     info.AddValue(CheckOverflowString, options.CheckOverflow);
     info.AddValue(PlatformString, (int)options.Platform);
     info.AddValue(GeneralDiagnosticOptionString, (int)options.GeneralDiagnosticOption);
     info.AddValue(WarningLevelString, options.WarningLevel);
     info.AddValue(SpecificDiagnosticOptionsString, new Dictionary<string, ReportDiagnostic>(options.SpecificDiagnosticOptions));
     info.AddValue(OptimizeString, (int)options.OptimizationLevel);
     info.AddValue(ConcurrentBuildString, options.ConcurrentBuild);
     info.AddValue(ExtendedCustomDebugInformationString, options.ExtendedCustomDebugInformation);
     info.AddValue(MetadataImportOptionsString, (byte)options.MetadataImportOptions);
     info.AddValue(FeaturesString, options.Features.ToArray());
 }
開發者ID:elemk0vv,項目名稱:roslyn-1,代碼行數:20,代碼來源:SerializableCompilationOptions.cs

示例10: ProjectInfo

 private ProjectInfo(
     ProjectAttributes attributes,
     CompilationOptions compilationOptions,
     ParseOptions parseOptions,
     IEnumerable<DocumentInfo> documents,
     IEnumerable<ProjectReference> projectReferences,
     IEnumerable<MetadataReference> metadataReferences,
     IEnumerable<AnalyzerReference> analyzerReferences,
     IEnumerable<DocumentInfo> additionalDocuments,
     Type hostObjectType)
 {
     Attributes = attributes;
     CompilationOptions = compilationOptions;
     ParseOptions = parseOptions;
     Documents = documents.ToImmutableReadOnlyListOrEmpty();
     ProjectReferences = projectReferences.ToImmutableReadOnlyListOrEmpty();
     MetadataReferences = metadataReferences.ToImmutableReadOnlyListOrEmpty();
     AnalyzerReferences = analyzerReferences.ToImmutableReadOnlyListOrEmpty();
     AdditionalDocuments = additionalDocuments.ToImmutableReadOnlyListOrEmpty();
     HostObjectType = hostObjectType;
 }
開發者ID:XieShuquan,項目名稱:roslyn,代碼行數:21,代碼來源:ProjectInfo.cs

示例11: GetDiagnosticItems

        private IEnumerable<DiagnosticItem> GetDiagnosticItems(string language, CompilationOptions options)
        {
            // Within an analyzer assembly, an individual analyzer may report multiple different diagnostics
            // with the same ID. Or, multiple analyzers may report diagnostics with the same ID. Or a
            // combination of the two may occur.
            // We only want to show one node in Solution Explorer for a given ID. So we pick one, but we need
            // to be consistent in which one we pick. Diagnostics with the same ID may have different
            // descriptions or messages, and it would be strange if the node's name changed from one run of
            // VS to another. So we group the diagnostics by ID, sort them within a group, and take the first
            // one.

            return _item.AnalyzerReference.GetAnalyzers(language)
                .SelectMany(a => _diagnosticAnalyzerService.GetDiagnosticDescriptors(a))
                .GroupBy(d => d.Id)
                .OrderBy(g => g.Key, StringComparer.CurrentCulture)
                .Select(g =>
                {
                    var selectedDiagnostic = g.OrderBy(d => d, s_comparer).First();
                    var effectiveSeverity = selectedDiagnostic.GetEffectiveSeverity(options);
                    return new DiagnosticItem(_item, selectedDiagnostic, effectiveSeverity, _commandHandler.DiagnosticContextMenuController);
                });
        }
開發者ID:Rickinio,項目名稱:roslyn,代碼行數:22,代碼來源:DiagnosticItemSource.cs

示例12: WithCompilationOptions

 public ProjectInfo WithCompilationOptions(CompilationOptions compilationOptions)
 {
     return With(compilationOptions: compilationOptions);
 }
開發者ID:XieShuquan,項目名稱:roslyn,代碼行數:4,代碼來源:ProjectInfo.cs

示例13: Create

 /// <summary>
 /// Create a new instance of a ProjectInfo.
 /// </summary>
 internal static ProjectInfo Create(
     ProjectId id,
     VersionStamp version,
     string name,
     string assemblyName,
     string language,
     string filePath,
     string outputFilePath,
     CompilationOptions compilationOptions,
     ParseOptions parseOptions,
     IEnumerable<DocumentInfo> documents,
     IEnumerable<ProjectReference> projectReferences,
     IEnumerable<MetadataReference> metadataReferences,
     IEnumerable<AnalyzerReference> analyzerReferences,
     IEnumerable<DocumentInfo> additionalDocuments,
     bool isSubmission,
     Type hostObjectType,
     bool hasAllInformation)
 {
     return new ProjectInfo(
         new ProjectAttributes(
             id,
             version,
             name,
             assemblyName,
             language,
             filePath,
             outputFilePath,
             isSubmission,
             hasAllInformation),
         compilationOptions,
         parseOptions,
         documents,
         projectReferences,
         metadataReferences,
         analyzerReferences,
         additionalDocuments,
         hostObjectType);
 }
開發者ID:XieShuquan,項目名稱:roslyn,代碼行數:42,代碼來源:ProjectInfo.cs

示例14: EqualsHelper

        protected bool EqualsHelper(CompilationOptions other)
        {
            if (object.ReferenceEquals(other, null))
            {
                return false;
            }

            // NOTE: StringComparison.Ordinal is used for type name comparisons, even for VB.  That's because
            // a change in the canonical case should still change the option.
            bool equal =
                   this.CheckOverflow == other.CheckOverflow &&
                   this.ConcurrentBuild == other.ConcurrentBuild &&
                   this.ExtendedCustomDebugInformation == other.ExtendedCustomDebugInformation &&
                   this.DebugPlusMode == other.DebugPlusMode &&
                   string.Equals(this.CryptoKeyContainer, other.CryptoKeyContainer, StringComparison.Ordinal) &&
                   string.Equals(this.CryptoKeyFile, other.CryptoKeyFile, StringComparison.Ordinal) &&
                   this.CryptoPublicKey.SequenceEqual(other.CryptoPublicKey) &&
                   this.DelaySign == other.DelaySign &&
                   this.GeneralDiagnosticOption == other.GeneralDiagnosticOption &&
                   string.Equals(this.MainTypeName, other.MainTypeName, StringComparison.Ordinal) &&
                   this.MetadataImportOptions == other.MetadataImportOptions &&
                   string.Equals(this.ModuleName, other.ModuleName, StringComparison.Ordinal) &&
                   this.OptimizationLevel == other.OptimizationLevel &&
                   this.OutputKind == other.OutputKind &&
                   this.Platform == other.Platform &&
                   this.ReportSuppressedDiagnostics == other.ReportSuppressedDiagnostics &&
                   string.Equals(this.ScriptClassName, other.ScriptClassName, StringComparison.Ordinal) &&
                   this.SpecificDiagnosticOptions.SequenceEqual(other.SpecificDiagnosticOptions, (left, right) => (left.Key == right.Key) && (left.Value == right.Value)) &&
                   this.WarningLevel == other.WarningLevel &&
                   object.Equals(this.MetadataReferenceResolver, other.MetadataReferenceResolver) &&
                   object.Equals(this.XmlReferenceResolver, other.XmlReferenceResolver) &&
                   object.Equals(this.SourceReferenceResolver, other.SourceReferenceResolver) &&
                   object.Equals(this.StrongNameProvider, other.StrongNameProvider) &&
                   object.Equals(this.AssemblyIdentityComparer, other.AssemblyIdentityComparer);

            return equal;
        }
開發者ID:nemec,項目名稱:roslyn,代碼行數:37,代碼來源:CompilationOptions.cs

示例15: TestMissingAsync

        protected async Task TestMissingAsync(
            string initialMarkup,
            ParseOptions parseOptions, CompilationOptions compilationOptions,
            IDictionary<OptionKey, object> options = null,
            string fixAllActionEquivalenceKey = null,
            object fixProviderData = null)
        {
            using (var workspace = await CreateWorkspaceFromFileAsync(initialMarkup, parseOptions, compilationOptions))
            {
                workspace.ApplyOptions(options);

                var actions = await GetCodeActionsAsync(workspace, fixAllActionEquivalenceKey, fixProviderData);
                Assert.True(actions == null || actions.Count == 0);
            }
        }
開發者ID:Rickinio,項目名稱:roslyn,代碼行數:15,代碼來源:AbstractCodeActionOrUserDiagnosticTest.cs


注:本文中的Microsoft.CodeAnalysis.CompilationOptions類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。