예제 #1
0
 public IAssemblyUniqueIdentifier GetIdentifier(IIntermediateAssembly assembly)
 {
     //if (assembly.PublicKeyInfo == null || assembly.PublicKeyInfo.PublicToken.Token == null || assembly.PublicKeyInfo.PublicToken.Token.Length == 0)
     return(TypeSystemIdentifiers.GetAssemblyIdentifier(assembly.Name, assembly.AssemblyInformation.AssemblyVersion, assembly.AssemblyInformation.Culture));
     //else
     //    return TypeSystemIdentifiers.GetAssemblyIdentifier(assembly.Name, assembly.AssemblyInformation.AssemblyVersion, assembly.AssemblyInformation.Culture, assembly.PublicKeyInfo.PublicToken.Token);
 }
예제 #2
0
        public static IAssemblyUniqueIdentifier GetVersionedMicrosoftVisualBasicLibrary(VisualBasicVersion languageVersion = VisualBasicVersion.CurrentVersion)
        {
            switch (languageVersion)
            {
            case VisualBasicVersion.Version07:
                return(TypeSystemIdentifiers.GetAssemblyIdentifier(microsoftVisualBasicLibName, vbV7, CultureIdentifiers.None, MicrosoftLanguageVendor.stdLibPublicKeyToken));

            case VisualBasicVersion.Version07_1:
                return(TypeSystemIdentifiers.GetAssemblyIdentifier(microsoftVisualBasicLibName, vbV7_1, CultureIdentifiers.None, MicrosoftLanguageVendor.stdLibPublicKeyToken));

            case VisualBasicVersion.Version08:
            case VisualBasicVersion.Version09:
                return(TypeSystemIdentifiers.GetAssemblyIdentifier(microsoftVisualBasicLibName, vbV8, CultureIdentifiers.None, MicrosoftLanguageVendor.stdLibPublicKeyToken));

            case VisualBasicVersion.Version10:
            case VisualBasicVersion.Version11:
            case VisualBasicVersion.Version12:
                return(TypeSystemIdentifiers.GetAssemblyIdentifier(microsoftVisualBasicLibName, vbV10, CultureIdentifiers.None, MicrosoftLanguageVendor.stdLibPublicKeyToken));

            default:
                goto case VisualBasicVersion.CurrentVersion;
            }
        }
예제 #3
0
        private static IAssemblyUniqueIdentifier GetVersionedStandardLibrary(string libraryName, CliFrameworkVersion version, CliFrameworkVersion introducedVersion, bool ecmaLibrary, byte[] alternatePublicKey = null, IVersion[] alternateVersions = null)
        {
            switch (version & CliFrameworkVersion.VersionMask)
            {
            case CliFrameworkVersion.v1_0_3705:
                switch (introducedVersion & CliFrameworkVersion.VersionMask)
                {
                case CliFrameworkVersion.v1_1_4322:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v1_1Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v2_0_50727:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v2Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v3_0:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v3Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v3_5:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v3_5Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v4_0_30319:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v4Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v4_5:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v4_5Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v4_6:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v4_6Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));
                }
                return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v1Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

            case CliFrameworkVersion.v1_1_4322:
                switch (introducedVersion & CliFrameworkVersion.VersionMask)
                {
                case CliFrameworkVersion.v2_0_50727:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v2Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v3_0:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v3Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v3_5:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v3_5Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v4_0_30319:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v4Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v4_5:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v4_5Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v4_6:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v4_6Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));
                }
                return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v1_1Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

            case CliFrameworkVersion.v2_0_50727:
                switch (introducedVersion & CliFrameworkVersion.VersionMask)
                {
                case CliFrameworkVersion.v3_0:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v3Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v3_5:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v3_5Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v4_0_30319:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v4Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v4_5:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v4_5Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v4_6:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v4_6Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));
                }
                return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v2Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

            case CliFrameworkVersion.v3_0:
                switch (introducedVersion & CliFrameworkVersion.VersionMask)
                {
                case CliFrameworkVersion.v1_0_3705:
                case CliFrameworkVersion.v1_1_4322:
                case CliFrameworkVersion.v2_0_50727:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v2Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v3_5:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v3_5Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v4_0_30319:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v4Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v4_5:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v4_5Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v4_6:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v4_6Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));
                }
                return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v3Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

            case CliFrameworkVersion.v3_5:
                switch (introducedVersion & CliFrameworkVersion.VersionMask)
                {
                case CliFrameworkVersion.v1_0_3705:
                case CliFrameworkVersion.v1_1_4322:
                case CliFrameworkVersion.v2_0_50727:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v2Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v3_0:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v3Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v4_0_30319:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v4Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v4_5:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v4_5Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

                case CliFrameworkVersion.v4_6:
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v4_6Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));
                }
                return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v3_5Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));

            case CliFrameworkVersion.v4_0_30319:
            case CliFrameworkVersion.v4_5:
            case CliFrameworkVersion.v4_6:
                if ((introducedVersion & CliFrameworkVersion.VersionMask) == CliFrameworkVersion.v4_6)
                {
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v4_6Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));
                }
                else if ((introducedVersion & CliFrameworkVersion.VersionMask) == CliFrameworkVersion.v4_5)
                {
                    return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v4_5Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));
                }
                return(TypeSystemIdentifiers.GetAssemblyIdentifier(libraryName, CliGateway.v4Version, CultureIdentifiers.None, ecmaLibrary ? StrongNameKeyPairHelper.StandardPublicKeyToken : alternatePublicKey));
            }

            /* *
             * If the version doesn't match the valid set of values,
             * yield the introduced version by a recursive call.
             * */
            if (version == introducedVersion)
            {
                throw new ArgumentOutOfRangeException("No version of introducedVersion yielded a library.", "introducedVersion");
            }
            return(GetVersionedStandardLibrary(libraryName, introducedVersion, introducedVersion, ecmaLibrary));
        }
예제 #4
0
 private IAssemblyUniqueIdentifier InitializeUniqueIdentifier()
 {
     return(TypeSystemIdentifiers.GetAssemblyIdentifier(this.RootLibrary.Name, TypeSystemIdentifiers.GetVersion(this.assemblyVersion.Major, this.assemblyVersion.Minor, this.assemblyVersion.Build, this.assemblyVersion.Revision), CultureIdentifiers.None, this.Version.Environment.GetPublicKeyToken(this._publicKeyId)));
 }