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


C# CodeAnalysis.AssemblyIdentity类代码示例

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


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

示例1: AssemblyIdentityAndLocation

            public AssemblyIdentityAndLocation(AssemblyIdentity identity, string location)
            {
                Debug.Assert(identity != null && location != null);

                this.Identity = identity;
                this.Location = location;
            }
开发者ID:GloryChou,项目名称:roslyn,代码行数:7,代码来源:InteractiveAssemblyLoader.cs

示例2: LoadFromPathUncheckedCore

        private Assembly LoadFromPathUncheckedCore(string fullPath, AssemblyIdentity identity = null)
        {
            Debug.Assert(PathUtilities.IsAbsolute(fullPath));

            // Check if we have already loaded an assembly with the same identity or from the given path.
            Assembly loadedAssembly = null;
            lock (_guard)
            {
                Assembly existingAssembly;
                if (_loadedAssembliesByPath.TryGetValue(fullPath, out existingAssembly))
                {
                    loadedAssembly = existingAssembly;
                }
                else
                {
                    identity = identity ?? GetOrAddAssemblyIdentity(fullPath);
                    if (identity != null && _loadedAssembliesByIdentity.TryGetValue(identity, out existingAssembly))
                    {
                        loadedAssembly = existingAssembly;
                    }
                }
            }

            // Otherwise, load the assembly.
            if (loadedAssembly == null)
            {
                loadedAssembly = LoadFromPathImpl(fullPath);
            }

            // Add the loaded assembly to both path and identity cache.
            return AddToCache(loadedAssembly, fullPath, identity);
        }
开发者ID:jkotas,项目名称:roslyn,代码行数:32,代码来源:AnalyzerAssemblyLoader.cs

示例3: MissingAnalyzerDependency

        public MissingAnalyzerDependency(string analyzerPath, AssemblyIdentity dependencyIdentity)
        {
            Debug.Assert(analyzerPath != null);
            Debug.Assert(dependencyIdentity != null);

            AnalyzerPath = analyzerPath;
            DependencyIdentity = dependencyIdentity;
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:8,代码来源:MissingAnalyzerDependency.cs

示例4: ModuleData

 public ModuleData(AssemblyIdentity identity, OutputKind kind, ImmutableArray<byte> image, ImmutableArray<byte> pdb, bool inMemoryModule)
 {
     this.Id = new ModuleDataId(identity.Name, identity.GetDisplayName(), GetMvid(image));
     this.Kind = kind;
     this.Image = image;
     this.Pdb = pdb;
     this.InMemoryModule = inMemoryModule;
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:8,代码来源:ModuleData.cs

示例5: ResolveMissingAssembly

        public override PortableExecutableReference ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity)
        {
            ResolutionAttempts.Add(new ReferenceAndIdentity(definition, referenceIdentity));

            MetadataReference reference;
            string nameAndVersion = referenceIdentity.Name + (referenceIdentity.Version != AssemblyIdentity.NullVersion ? $", {referenceIdentity.Version}" : "");
            return _map.TryGetValue(nameAndVersion, out reference) ? (PortableExecutableReference)reference : null;
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:8,代码来源:TestMissingMetadataReferenceResolver.cs

示例6: ResolveMissingAssembly

        public override PortableExecutableReference ResolveMissingAssembly(AssemblyIdentity identity)
        {
            ResolutionAttempts.Add(identity);

            MetadataReference reference;
            string nameAndVersion = identity.Name + (identity.Version != AssemblyIdentity.NullVersion ? $", {identity.Version}" : "");
            return _map.TryGetValue(nameAndVersion, out reference) ? (PortableExecutableReference)reference : null;
        }
开发者ID:hbarve1,项目名称:roslyn,代码行数:8,代码来源:TestMissingMetadataReferenceResolver.cs

示例7: AnalyzerDependencyConflict

        public AnalyzerDependencyConflict(AssemblyIdentity identity, string analyzerFilePath1, string analyzerFilePath2)
        {
            Debug.Assert(identity != null);
            Debug.Assert(analyzerFilePath1 != null);
            Debug.Assert(analyzerFilePath2 != null);

            Identity = identity;
            AnalyzerFilePath1 = analyzerFilePath1;
            AnalyzerFilePath2 = analyzerFilePath2;
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:10,代码来源:AnalyzerDependencyConflict.cs

示例8: CreateAddMetadataReferenceOperation

        public CodeActionOperation CreateAddMetadataReferenceOperation(ProjectId projectId, AssemblyIdentity assemblyIdentity)
        {
            if (projectId == null)
            {
                throw new ArgumentNullException("projectId");
            }

            if (assemblyIdentity == null)
            {
                throw new ArgumentNullException("assemblyIdentity");
            }

            return new AddMetadataReferenceOperation(projectId, assemblyIdentity);
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:14,代码来源:VisualStudioAddMetadataReferenceCodeActionOperationFactoryWorkspaceService.cs

示例9: ResolveMissingAssembly

        public override PortableExecutableReference ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity)
        {
            // resolve assemblies from the directory containing the test and from directory containing corlib

            string name = referenceIdentity.Name;
            string testDir = Path.GetDirectoryName(GetType().GetTypeInfo().Assembly.ManifestModule.FullyQualifiedName);
            string testDependencyAssemblyPath = Path.Combine(testDir, name + ".dll");
            if (File.Exists(testDependencyAssemblyPath))
            {
                return MetadataReference.CreateFromFile(testDependencyAssemblyPath, s_resolvedMissingAssemblyReferenceProperties);
            }

            string fxDir = Path.GetDirectoryName(typeof(object).GetTypeInfo().Assembly.ManifestModule.FullyQualifiedName);
            string fxAssemblyPath = Path.Combine(fxDir, name + ".dll");
            if (File.Exists(fxAssemblyPath))
            {
                return MetadataReference.CreateFromFile(fxAssemblyPath, s_resolvedMissingAssemblyReferenceProperties);
            }

            return null;
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:21,代码来源:TestRuntimeMetadataReferenceResolver.cs

示例10: PEAssembly

        /// <exception cref="BadImageFormatException"/>
        internal PEAssembly(AssemblyMetadata owner, ImmutableArray<PEModule> modules)
        {
            Debug.Assert(!modules.IsDefault);
            Debug.Assert(modules.Length > 0);

            this.identity = modules[0].ReadAssemblyIdentityOrThrow();

            var refs = ArrayBuilder<AssemblyIdentity>.GetInstance();
            int[] refCounts = new int[modules.Length];

            for (int i = 0; i < modules.Length; i++)
            {
                ImmutableArray<AssemblyIdentity> refsForModule = modules[i].ReferencedAssemblies;
                refCounts[i] = refsForModule.Length;
                refs.AddRange(refsForModule);
            }

            this.modules = modules;
            this.AssemblyReferences = refs.ToImmutableAndFree();
            this.ModuleReferenceCounts = refCounts.AsImmutableOrNull();
            this.owner = owner;
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:23,代码来源:PEAssembly.cs

示例11: TestMissingMetadataSymbol

        public void TestMissingMetadataSymbol()
        {
            AssemblyIdentity missingAssemblyId = new AssemblyIdentity("foo");
            AssemblySymbol assem = new MockAssemblySymbol("banana");
            ModuleSymbol module = new MissingModuleSymbol(assem, ordinal: -1);
            NamedTypeSymbol container = new MockNamedTypeSymbol("TestClass", Enumerable.Empty<Symbol>(), TypeKind.Class);

            var mms1 = new MissingMetadataTypeSymbol.TopLevel(new MissingAssemblySymbol(missingAssemblyId).Modules[0], "Elvis", "Lives", 2, true);
            Assert.Equal(2, mms1.Arity);
            Assert.Equal("Elvis", mms1.NamespaceName);
            Assert.Equal("Lives", mms1.Name);
            Assert.Equal("Elvis.Lives<,>[missing]", mms1.ToTestDisplayString());
            Assert.Equal("foo", mms1.ContainingAssembly.Identity.Name);

            var mms2 = new MissingMetadataTypeSymbol.TopLevel(module, "Elvis.Is", "Cool", 0, true);
            Assert.Equal(0, mms2.Arity);
            Assert.Equal("Elvis.Is", mms2.NamespaceName);
            Assert.Equal("Cool", mms2.Name);
            Assert.Equal("Elvis.Is.Cool[missing]", mms2.ToTestDisplayString());
            Assert.Same(assem, mms2.ContainingAssembly);

            // TODO: Add test for 3rd constructor.
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:23,代码来源:MockSymbolTests.cs

示例12: AddMetadataReferenceOperation

 public AddMetadataReferenceOperation(ProjectId projectId, AssemblyIdentity assemblyIdentity)
 {
     _projectId = projectId;
     _assemblyIdentity = assemblyIdentity;
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:5,代码来源:VisualStudioAddMetadataReferenceCodeActionOperationFactoryWorkspaceService.cs

示例13: AnalyzerInfo

 public AnalyzerInfo(string filePath, AssemblyIdentity identity, Guid mvid, ImmutableArray<AssemblyIdentity> references)
 {
     Path = filePath;
     Identity = identity;
     MVID = mvid;
     References = references;
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:7,代码来源:AnalyzerDependencyChecker.cs

示例14: ApplyUnificationPolicies

        internal override bool ApplyUnificationPolicies(
            ref AssemblyIdentity reference,
            ref AssemblyIdentity definition,
            AssemblyIdentityParts referenceParts,
            out bool isFxAssembly)
        {
            if (reference.ContentType == AssemblyContentType.Default &&
                SimpleNameComparer.Equals(reference.Name, definition.Name) &&
                SimpleNameComparer.Equals(reference.Name, "mscorlib"))
            {
                isFxAssembly = true;
                reference = definition;
                return true;
            }

            if (!reference.IsRetargetable && definition.IsRetargetable)
            {
                // Reference is not retargetable, but definition is retargetable.
                // Non-equivalent.
                isFxAssembly = false;
                return false;
            }

            // Notes:
            // an assembly might be both retargetable and portable
            // in that case retargeatable table acts as an override.

            // Apply portability policy transforms first (e.g. rewrites references to SL assemblies to their desktop equivalents)
            // If the reference is partial and is missing version or PKT it is not ported.
            reference = Port(reference);
            definition = Port(definition);

            if (reference.IsRetargetable && !definition.IsRetargetable)
            {
                if (!AssemblyIdentity.IsFullName(referenceParts))
                {
                    isFxAssembly = false;
                    return false;
                }

                // Reference needs to be retargeted before comparison, 
                // unless it's optionally retargetable and we already match the PK
                bool skipRetargeting = IsOptionallyRetargetableAssembly(reference) &&
                                       AssemblyIdentity.KeysEqual(reference, definition);

                if (!skipRetargeting)
                {
                    reference = Retarget(reference);
                }
            }

            // At this point we are in one of the following states:
            //
            //   1) Both ref/def are not retargetable
            //   2) Both ref/def are retargetable
            //   3) Ref is retargetable (and has been retargeted)
            //
            // We can do a straight compare of ref/def at this point using the
            // regular rules

            if (reference.IsRetargetable && definition.IsRetargetable)
            {
                isFxAssembly = IsRetargetableAssembly(definition);
            }
            else
            {
                isFxAssembly = IsFrameworkAssembly(definition);
            }

            return true;
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:71,代码来源:DesktopAssemblyIdentityComparer.cs

示例15: Port

        private AssemblyIdentity Port(AssemblyIdentity identity)
        {
            if (identity.IsRetargetable || !identity.IsStrongName || identity.ContentType != AssemblyContentType.Default)
            {
                return identity;
            }

            Version newVersion = null;
            ImmutableArray<byte> newPublicKeyToken = default(ImmutableArray<byte>);

            var version = (AssemblyVersion)identity.Version;
            if (version >= new AssemblyVersion(2, 0, 0, 0) && version <= new AssemblyVersion(5, 9, 0, 0))
            {
                if (identity.PublicKeyToken.SequenceEqual(SILVERLIGHT_PLATFORM_PUBLICKEY_STR_L))
                {
                    if (!policy.SuppressSilverlightPlatformAssembliesPortability)
                    {
                        if (SimpleNameComparer.Equals(identity.Name, "System") ||
                            SimpleNameComparer.Equals(identity.Name, "System.Core"))
                        {
                            newVersion = (Version)VER_ASSEMBLYVERSION_STR_L;
                            newPublicKeyToken = ECMA_PUBLICKEY_STR_L;
                        }
                    }
                }
                else if (identity.PublicKeyToken.SequenceEqual(SILVERLIGHT_PUBLICKEY_STR_L))
                {
                    if (!policy.SuppressSilverlightLibraryAssembliesPortability)
                    {
                        if (SimpleNameComparer.Equals(identity.Name, "Microsoft.VisualBasic"))
                        {
                            newVersion = new Version(10, 0, 0, 0);
                            newPublicKeyToken = MICROSOFT_PUBLICKEY_STR_L;
                        }

                        if (SimpleNameComparer.Equals(identity.Name, "System.ComponentModel.Composition"))
                        {
                            newVersion = (Version)VER_ASSEMBLYVERSION_STR_L;
                            newPublicKeyToken = ECMA_PUBLICKEY_STR_L;
                        }
                    }
                }
            }

            if (newVersion == null)
            {
                return identity;
            }

            return new AssemblyIdentity(
                identity.Name,
                newVersion,
                identity.CultureName,
                newPublicKeyToken,
                hasPublicKey: false,
                isRetargetable: identity.IsRetargetable,
                contentType: AssemblyContentType.Default);
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:58,代码来源:DesktopAssemblyIdentityComparer.cs


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