本文整理汇总了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());
}
示例2: SetOptionsCore
private void SetOptionsCore(CompilationOptions newCompilationOptions)
{
lock (_gate)
{
_currentCompilationOptions = newCompilationOptions;
}
}
示例3: TestHostSolution
public TestHostSolution(
HostLanguageServices languageServiceProvider,
CompilationOptions compilationOptions,
ParseOptions parseOptions,
params MetadataReference[] references)
: this(new TestHostProject(languageServiceProvider, compilationOptions, parseOptions, references))
{
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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));
}
}
示例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());
}
示例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;
}
示例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);
});
}
示例12: WithCompilationOptions
public ProjectInfo WithCompilationOptions(CompilationOptions compilationOptions)
{
return With(compilationOptions: compilationOptions);
}
示例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);
}
示例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;
}
示例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);
}
}