本文整理汇总了C#中Microsoft.CodeAnalysis.CompilationOptions类的典型用法代码示例。如果您正苦于以下问题:C# CompilationOptions类的具体用法?C# CompilationOptions怎么用?C# CompilationOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompilationOptions类属于Microsoft.CodeAnalysis命名空间,在下文中一共展示了CompilationOptions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: CanReuseCompilationReferenceManager
internal bool CanReuseCompilationReferenceManager(CompilationOptions other)
{
// This condition has to include all options the Assembly Manager depends on when binding references.
// In addition, the assembly name is determined based upon output kind. It is special for netmodules.
// Can't reuse when file resolver or identity comparers change.
// Can reuse even if StrongNameProvider changes. When resolving a cyclic reference only the simple name is considered, not the strong name.
return this.MetadataImportOptions == other.MetadataImportOptions
&& this.OutputKind.IsNetModule() == other.OutputKind.IsNetModule()
&& object.Equals(this.XmlReferenceResolver, other.XmlReferenceResolver)
&& object.Equals(this.MetadataReferenceResolver, other.MetadataReferenceResolver)
&& object.Equals(this.AssemblyIdentityComparer, other.AssemblyIdentityComparer);
}
开发者ID:nemec,项目名称:roslyn,代码行数:12,代码来源:CompilationOptions.cs
示例17: CreateWorkspaceFromFileAsync
protected abstract Task<TestWorkspace> CreateWorkspaceFromFileAsync(string definition, ParseOptions parseOptions, CompilationOptions compilationOptions);
开发者ID:Rickinio,项目名称:roslyn,代码行数:1,代码来源:AbstractCodeActionOrUserDiagnosticTest.cs
示例18: With
private ProjectInfo With(
ProjectId id = null,
VersionStamp? version = default(VersionStamp?),
string name = null,
string assemblyName = null,
string language = null,
Optional<string> filePath = default(Optional<string>),
Optional<string> outputPath = default(Optional<string>),
CompilationOptions compilationOptions = null,
ParseOptions parseOptions = null,
IEnumerable<DocumentInfo> documents = null,
IEnumerable<ProjectReference> projectReferences = null,
IEnumerable<MetadataReference> metadataReferences = null,
IEnumerable<AnalyzerReference> analyzerReferences = null,
Optional<bool> isSubmission = default(Optional<bool>),
Optional<Type> hostObjectType = default(Optional<Type>))
{
var newId = id ?? this.Id;
var newVersion = version.HasValue ? version.Value : this.Version;
var newName = name ?? this.Name;
var newAssemblyName = assemblyName ?? this.AssemblyName;
var newLanguage = language ?? this.Language;
var newFilepath = filePath.HasValue ? filePath.Value : this.FilePath;
var newOutputPath = outputPath.HasValue ? outputPath.Value : this.OutputFilePath;
var newCompilationOptions = compilationOptions ?? this.CompilationOptions;
var newParseOptions = parseOptions ?? this.ParseOptions;
var newDocuments = documents ?? this.Documents;
var newProjectReferences = projectReferences ?? this.ProjectReferences;
var newMetadataReferences = metadataReferences ?? this.MetadataReferences;
var newAnalyzerReferences = analyzerReferences ?? this.AnalyzerReferences;
var newIsSubmission = isSubmission.HasValue ? isSubmission.Value : this.IsSubmission;
var newHostObjectType = hostObjectType.HasValue ? hostObjectType.Value : this.HostObjectType;
if (newId == this.Id &&
newVersion == this.Version &&
newName == this.Name &&
newAssemblyName == this.AssemblyName &&
newLanguage == this.Language &&
newFilepath == this.FilePath &&
newOutputPath == this.OutputFilePath &&
newCompilationOptions == this.CompilationOptions &&
newParseOptions == this.ParseOptions &&
newDocuments == this.Documents &&
newProjectReferences == this.ProjectReferences &&
newMetadataReferences == this.MetadataReferences &&
newAnalyzerReferences == this.AnalyzerReferences &&
newIsSubmission == this.IsSubmission &&
newHostObjectType == this.HostObjectType)
{
return this;
}
return new ProjectInfo(
newId,
newVersion,
newName,
newAssemblyName,
newLanguage,
newFilepath,
newOutputPath,
newCompilationOptions,
newParseOptions,
newDocuments,
newProjectReferences,
newMetadataReferences,
newAnalyzerReferences,
newIsSubmission,
newHostObjectType);
}
开发者ID:pheede,项目名称:roslyn,代码行数:69,代码来源:ProjectInfo.cs
示例19: TestActionCountAsync
protected async Task TestActionCountAsync(
string initialMarkup,
int count,
ParseOptions parseOptions = null, CompilationOptions compilationOptions = null)
{
using (var workspace = await CreateWorkspaceFromFileAsync(initialMarkup, parseOptions, compilationOptions))
{
var actions = await GetCodeActionsAsync(workspace, fixAllActionEquivalenceKey: null);
Assert.Equal(count, actions.Count());
}
}
开发者ID:Rickinio,项目名称:roslyn,代码行数:12,代码来源:AbstractCodeActionOrUserDiagnosticTest.cs
示例20: TestAddDocument
private async Task TestAddDocument(
string initialMarkup, string expectedMarkup,
int index,
IList<string> expectedContainers,
string expectedDocumentName,
ParseOptions parseOptions, CompilationOptions compilationOptions,
bool compareTokens, bool isLine)
{
using (var workspace = isLine
? await CreateWorkspaceFromFileAsync(initialMarkup, parseOptions, compilationOptions)
: await TestWorkspace.CreateAsync(initialMarkup))
{
var codeActions = await GetCodeActionsAsync(workspace, fixAllActionEquivalenceKey: null);
await TestAddDocument(workspace, expectedMarkup, index, expectedContainers, expectedDocumentName,
codeActions, compareTokens);
}
}
开发者ID:Rickinio,项目名称:roslyn,代码行数:17,代码来源:AbstractCodeActionOrUserDiagnosticTest.cs
注:本文中的Microsoft.CodeAnalysis.CompilationOptions类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论