public void ConvertToString()
        {
            AssemblyIdentity a = new AssemblyIdentity("MyAssembly", "1.0.0.0");

            Assert.AreEqual("MyAssembly, Version=1.0.0.0", a.ToString("D"));
            Assert.AreEqual("MyAssembly_1.0.0.0", a.ToString("N"));
            Assert.AreEqual("MyAssembly, Version=1.0.0.0, Culture=, PublicKeyToken=, ProcessorArchitecture=", a.ToString("P"));
        }
 /// <summary>
 /// Initializes a new instance of the ApplicationIdentity class.
 /// </summary>
 /// <param name="url">The deployment provider URL for the ClickOnce deployment manifest.</param>
 /// <param name="deployManifestPath">Path to ClickOnce deployment manifest. The assembly identity will be obtained from the specified file.</param>
 /// <param name="applicationManifestPath">Path to ClickOnce application manifest. The assembly identity will be obtained from the specified file.</param>
 public ApplicationIdentity(string url, string deployManifestPath, string applicationManifestPath)
 {
     if (String.IsNullOrEmpty(url))
         throw new ArgumentNullException("url");
     if (String.IsNullOrEmpty(deployManifestPath))
         throw new ArgumentNullException("deployManifestPath");
     if (String.IsNullOrEmpty(applicationManifestPath))
         throw new ArgumentNullException("applicationManifestPath");
     _url = url;
     _deployManifestIdentity = AssemblyIdentity.FromManifest(deployManifestPath);
     _applicationManifestIdentity = AssemblyIdentity.FromManifest(applicationManifestPath);
 }
 public AssemblyIdentity(AssemblyIdentity identity)
 {
     if (identity != null)
     {
         this.name = identity.name;
         this.version = identity.version;
         this.publicKeyToken = identity.publicKeyToken;
         this.culture = identity.culture;
         this.processorArchitecture = identity.processorArchitecture;
         this.type = identity.type;
     }
 }
        /// <summary>
        /// Initializes a new instance of the ApplicationIdentity class.
        /// </summary>
        /// <param name="url">The deployment provider URL for the ClickOnce deployment manifest.</param>
		/// <param name="deployManifestPath">Assembly identity of the ClickOnce deployment manifest.</param>
		/// <param name="applicationManifestPath">Assembly identity of the ClickOnce application manifest.</param>
		public ApplicationIdentity(string url, AssemblyIdentity deployManifestIdentity, AssemblyIdentity applicationManifestIdentity)
        {
            if (String.IsNullOrEmpty(url))
                throw new ArgumentNullException("url");
            if (deployManifestIdentity == null)
                throw new ArgumentNullException("deployManifestIdentity");
            if (applicationManifestIdentity == null)
                throw new ArgumentNullException("applicationManifestIdentity");
            _url = url;
            _deployManifestIdentity = deployManifestIdentity;
            _applicationManifestIdentity = applicationManifestIdentity;
        }
 public AssemblyReference Find(AssemblyIdentity identity)
 {
     if (identity != null)
     {
         foreach (AssemblyReference reference in this.list)
         {
             AssemblyIdentity assemblyIdentity = reference.AssemblyIdentity;
             if ((((assemblyIdentity == null) && (identity.Name != null)) && ((reference.SourcePath != null) && (reference.ReferenceType == AssemblyReferenceType.ManagedAssembly))) && string.Equals(identity.Name, Path.GetFileNameWithoutExtension(reference.SourcePath), StringComparison.OrdinalIgnoreCase))
             {
                 assemblyIdentity = AssemblyIdentity.FromManagedAssembly(reference.SourcePath);
             }
             if (AssemblyIdentity.IsEqual(assemblyIdentity, identity))
             {
                 return reference;
             }
         }
     }
     return null;
 }
        public void IsFrameworkAssemblyTest()
        {
            bool actual;
            IList<string> listOfInstalledFrameworks = FrameworkMultiTargeting.GetSupportedTargetFrameworks();

            // if 2.0 is installed on this computer, we will test IsFrameworkAssembly for 2.0 assemblies.
            if (hasVersion(listOfInstalledFrameworks, "Version=v2.0"))
            {
                //if (hasVersion(listOfInstalledFrameworks
                // Test 2.0 CLR binary
                // "Microsoft.Build.Engine" Version="2.0.0.0" PublicKeyToken="b03f5f7f11d50a3a" Culture="neutral" ProcessorArchitecture="MSIL" FileVersion="2.0.50727.3026" InGAC="true" />
                AssemblyIdentity clr2Binary = new AssemblyIdentity("Microsoft.Build.Engine", "2.0.0.0", "b03f5f7f11d50a3a", "neutral", "MSIL");
                actual = clr2Binary.IsFrameworkAssembly;
                Assert.IsTrue(actual);
            }

            if (hasVersion(listOfInstalledFrameworks, "Version=v3.0"))
            {
                // Test 3.0 CLR binary
                // AssemblyName="System.ServiceModel" Version="3.0.0.0" PublicKeyToken="b77a5c561934e089" Culture="neutral" ProcessorArchitecture="MSIL" InGAC="false" IsRedistRoot="true" />
                AssemblyIdentity clr3Binary = new AssemblyIdentity("System.ServiceModel", "3.0.0.0", "b77a5c561934e089", "neutral", "MSIL");
                actual = clr3Binary.IsFrameworkAssembly;
                Assert.IsTrue(actual);
            }

            if (hasVersion(listOfInstalledFrameworks, "Version=v3.5"))
            {
                // Test 3.5 CLR binary
                // AssemblyName="Microsoft.Build.Tasks.v3.5" Version="3.5.0.0" PublicKeyToken="b03f5f7f11d50a3a" Culture="neutral" ProcessorArchitecture="MSIL" InGAC="false" />
                AssemblyIdentity clr35Binary = new AssemblyIdentity("Microsoft.Build.Tasks.v3.5", "3.5.0.0", "b03f5f7f11d50a3a", "neutral", "MSIL");
                actual = clr35Binary.IsFrameworkAssembly;
                Assert.IsTrue(actual);
            }

            if (hasVersion(listOfInstalledFrameworks, "Version=v4.0"))
            {
                // Test 4.0 CLR binary
                // AssemblyName="Microsoft.VisualBasic" Version="10.0.0.0" PublicKeyToken="b03f5f7f11d50a3a" Culture="neutral" ProcessorArchitecture="MSIL" FileVersion="4.0.41117.0" InGAC="true" />
                AssemblyIdentity clr4Binary = new AssemblyIdentity("Microsoft.VisualBasic", "10.0.0.0", "b03f5f7f11d50a3a", "neutral", "MSIL");
                actual = clr4Binary.IsFrameworkAssembly;
                Assert.IsTrue(actual);
            }
        }
Example #7
0
		public ApplicationIdentity (string url,
					    AssemblyIdentity deployManifestIdentity,
					    AssemblyIdentity applicationManifestIdentity)
		{
			throw new NotImplementedException ();
		}
Example #8
0
        private static ITaskItem[] RemoveDuplicateItems(ITaskItem[] items)
        {
            if (items == null)
                return null;
            if (items.Length <= 1)
                return items;
            Hashtable list = new Hashtable();
            foreach (ITaskItem item in items)
            {
                if (String.IsNullOrEmpty(item.ItemSpec))
                    continue;

                string key = null;
                AssemblyIdentity id = new AssemblyIdentity(item.ItemSpec);
                if (id.IsStrongName)
                {
                    key = id.GetFullName(AssemblyIdentity.FullNameFlags.All);
                }
                else
                {
                    key = Path.GetFullPath(item.ItemSpec).ToUpperInvariant();
                }

                if (!list.Contains(key))
                    list.Add(key, item);
            }

            ITaskItem[] outputItems = new ITaskItem[list.Count];
            list.Values.CopyTo(outputItems, 0);
            return outputItems;
        }
        public void AttemptResolveButFailed()
        {
            AssemblyIdentity a = new AssemblyIdentity("MyAssembly", "1.0.0.0");

            string path = a.Resolve(new string [] {Path.GetTempPath()});
        }
 private static ITaskItem[] RemoveDuplicateItems(ITaskItem[] items)
 {
     if (items == null)
     {
         return null;
     }
     if (items.Length <= 1)
     {
         return items;
     }
     Hashtable hashtable = new Hashtable();
     foreach (ITaskItem item in items)
     {
         if (!string.IsNullOrEmpty(item.ItemSpec))
         {
             string key = null;
             AssemblyIdentity identity = new AssemblyIdentity(item.ItemSpec);
             if (identity.IsStrongName)
             {
                 key = identity.GetFullName(AssemblyIdentity.FullNameFlags.All);
             }
             else
             {
                 key = Path.GetFullPath(item.ItemSpec).ToUpperInvariant();
             }
             if (!hashtable.Contains(key))
             {
                 hashtable.Add(key, item);
             }
         }
     }
     ITaskItem[] array = new ITaskItem[hashtable.Count];
     hashtable.Values.CopyTo(array, 0);
     return array;
 }
		public AssemblyReference Find (AssemblyIdentity identity)
		{
			throw new NotImplementedException ();
		}
 public ApplicationIdentity(string url,
                            AssemblyIdentity deployManifestIdentity,
                            AssemblyIdentity applicationManifestIdentity)
 {
     throw new NotImplementedException();
 }
Example #13
0
 /// <summary>
 /// Initializes a new instance of the AssemblyIdentity class.
 /// </summary>
 /// <param name="identity">Specifies another instance to duplicate.</param>
 public AssemblyIdentity(AssemblyIdentity identity)
 {
     if (identity == null)
         return;
     _name = identity._name;
     _version = identity._version;
     _publicKeyToken = identity._publicKeyToken;
     _culture = identity._culture;
     _processorArchitecture = identity._processorArchitecture;
     _type = identity._type;
 }
Example #14
0
 internal static bool IsEqual(AssemblyIdentity a1, AssemblyIdentity a2)
 {
     return IsEqual(a1, a2, true);
 }
 private void EnsureAssemblyReferenceExists(ApplicationManifest manifest, AssemblyIdentity identity)
 {
     if (manifest.AssemblyReferences.Find(identity) == null)
     {
         AssemblyReference assembly = new AssemblyReference();
         assembly.IsPrerequisite = true;
         assembly.AssemblyIdentity = identity;
         manifest.AssemblyReferences.Add(assembly);
     }
 }
 private void UpdateEntryPoint()
 {
     if (this.entryPoint != null)
     {
         this.entryPointIdentity = new AssemblyIdentity(this.entryPoint.AssemblyIdentity);
         this.entryPointPath = this.entryPoint.TargetPath;
     }
     else
     {
         this.entryPointIdentity = null;
         this.entryPointPath = null;
     }
 }
Example #17
0
 public ApplicationIdentity(string url, AssemblyIdentity deployManifestIdentity, AssemblyIdentity applicationManifestIdentity)
 {
     if (String.IsNullOrEmpty(url))
     {
         throw new ArgumentNullException(nameof(url));
     }
     _url = url;
     _deployManifestIdentity      = deployManifestIdentity ?? throw new ArgumentNullException(nameof(deployManifestIdentity));
     _applicationManifestIdentity = applicationManifestIdentity ?? throw new ArgumentNullException(nameof(applicationManifestIdentity));
 }
 private AssemblyIdentity CreateAssemblyIdentity(AssemblyIdentity baseIdentity, AssemblyIdentity entryPointIdentity)
 {
     string assemblyName = this.assemblyName;
     string assemblyVersion = this.assemblyVersion;
     string publicKeyToken = "0000000000000000";
     string targetCulture = this.targetCulture;
     if (string.IsNullOrEmpty(assemblyName))
     {
         if ((baseIdentity != null) && !string.IsNullOrEmpty(baseIdentity.Name))
         {
             assemblyName = baseIdentity.Name;
         }
         else if ((entryPointIdentity != null) && !string.IsNullOrEmpty(entryPointIdentity.Name))
         {
             if (this.manifest is DeployManifest)
             {
                 assemblyName = Path.GetFileNameWithoutExtension(entryPointIdentity.Name) + ".application";
             }
             else if (this.manifest is ApplicationManifest)
             {
                 assemblyName = entryPointIdentity.Name + ".exe";
             }
         }
     }
     if (string.IsNullOrEmpty(assemblyName))
     {
         base.Log.LogErrorWithCodeFromResources("GenerateManifest.NoIdentity", new object[0]);
         return null;
     }
     if (string.IsNullOrEmpty(assemblyVersion))
     {
         if ((baseIdentity != null) && !string.IsNullOrEmpty(baseIdentity.Version))
         {
             assemblyVersion = baseIdentity.Version;
         }
         else if ((entryPointIdentity != null) && !string.IsNullOrEmpty(entryPointIdentity.Version))
         {
             assemblyVersion = entryPointIdentity.Version;
         }
     }
     if (string.IsNullOrEmpty(assemblyVersion))
     {
         assemblyVersion = "1.0.0.0";
     }
     if (string.IsNullOrEmpty(targetCulture))
     {
         if ((baseIdentity != null) && !string.IsNullOrEmpty(baseIdentity.Culture))
         {
             targetCulture = baseIdentity.Culture;
         }
         else if ((entryPointIdentity != null) && !string.IsNullOrEmpty(entryPointIdentity.Culture))
         {
             targetCulture = entryPointIdentity.Culture;
         }
     }
     if ((string.IsNullOrEmpty(targetCulture) || string.Equals(targetCulture, "neutral", StringComparison.OrdinalIgnoreCase)) || string.Equals(targetCulture, "*", StringComparison.OrdinalIgnoreCase))
     {
         targetCulture = "neutral";
     }
     if (string.IsNullOrEmpty(this.processorArchitecture))
     {
         if ((baseIdentity != null) && !string.IsNullOrEmpty(baseIdentity.ProcessorArchitecture))
         {
             this.processorArchitecture = baseIdentity.ProcessorArchitecture;
         }
         else if ((entryPointIdentity != null) && !string.IsNullOrEmpty(entryPointIdentity.ProcessorArchitecture))
         {
             this.processorArchitecture = entryPointIdentity.ProcessorArchitecture;
         }
     }
     if (string.IsNullOrEmpty(this.processorArchitecture))
     {
         this.processorArchitecture = "msil";
     }
     if (this.manifest is ApplicationManifest)
     {
         ApplicationManifest manifest = this.manifest as ApplicationManifest;
         if (!manifest.IsClickOnceManifest)
         {
             publicKeyToken = null;
             if (string.Compare(targetCulture, "neutral", StringComparison.OrdinalIgnoreCase) == 0)
             {
                 targetCulture = null;
             }
             if (string.Compare(this.processorArchitecture, "msil", StringComparison.OrdinalIgnoreCase) == 0)
             {
                 this.processorArchitecture = null;
             }
         }
     }
     return new AssemblyIdentity(assemblyName, assemblyVersion, publicKeyToken, targetCulture, this.processorArchitecture);
 }
Example #19
0
 public AssemblyReference Find(AssemblyIdentity identity)
 {
     throw new NotImplementedException();
 }
Example #20
0
		public AssemblyIdentity (AssemblyIdentity identity)
		{
			throw new NotImplementedException ();
		}
Example #21
0
 public AssemblyIdentity(AssemblyIdentity identity)
 {
     throw new NotImplementedException();
 }
        /// <summary>
        /// Finds an assembly reference in the collection by the specified assembly identity.
        /// </summary>
        /// <param name="identity">The specified assembly identity.</param>
        /// <returns>The found assembly reference.</returns>
        public AssemblyReference Find(AssemblyIdentity identity)
        {
            if (identity == null)
                return null;

            foreach (AssemblyReference a in _list)
            {
                AssemblyIdentity listItemIdentity = a.AssemblyIdentity;

                // if the item in our list doesn't have an identity but is a managed assembly, 
                //  we calculate it by reading the file from disk to find its identity.
                //
                // note that this is here specifically to deal with the scenario when we are being
                //  asked to find a reference to one of our sentinel assemblies which are known to 
                //  be managed assemblies. doing this ensures that our sentinel assemblies do not 
                //  show up twice in the manifest.
                //
                // we are assuming the incoming identity for the sentinel assembly really is the
                //  sentinel assembly that MS owns and emits in manifests for ClickOnce application
                //  prereq verification for .Net 2.0, 3.0 and 3.5 frameworks. otherwise, we expect
                //  the incoming identity to fail the comparison (because something like the
                //  public key token won't match if there is a user-owned reference to something
                //  that has the same name as a sentinel assembly).
                //
                // note that we only read the file from disk if the incoming identity's name matches
                //  the file-name of the item in the list to avoid unnecessarily loading every
                //  reference in the list of references
                //
                if (listItemIdentity == null &&
                    identity.Name != null &&
                    a.SourcePath != null &&
                    a.ReferenceType == AssemblyReferenceType.ManagedAssembly &&
                    String.Equals(identity.Name, System.IO.Path.GetFileNameWithoutExtension(a.SourcePath), StringComparison.OrdinalIgnoreCase))
                {
                    listItemIdentity = AssemblyIdentity.FromManagedAssembly(a.SourcePath);
                }

                if (AssemblyIdentity.IsEqual(listItemIdentity, identity))
                {
                    return a;
                }
            }

            return null;
        }
Example #23
0
 internal static bool IsEqual(AssemblyIdentity a1, AssemblyIdentity a2)
 {
     return(IsEqual(a1, a2, true));
 }
Example #24
0
        /// <summary>
        /// Obtains identity of the specified .NET assembly.
        /// File must be a .NET assembly.
        /// Returns null if identity could not be obtained.
        /// </summary>
        /// <param name="path">The name of the file from which the identity is to be obtained.</param>
        /// <returns>The assembly identity of the specified file.</returns>
        public static AssemblyIdentity FromManagedAssembly(string path)
        {
            if (!File.Exists(path))
                return null;

            // NOTE: We're not using System.Reflection.AssemblyName class here because we need ProcessorArchitecture
            using (MetadataReader r = MetadataReader.Create(path))
            {
                AssemblyIdentity identity = null;
                if (r != null)
                {
                    try
                    {
                        identity = new AssemblyIdentity(r.Name, r.Version, r.PublicKeyToken, r.Culture, r.ProcessorArchitecture);
                    }
                    catch (ArgumentException e)
                    {
                        if (e.HResult != unchecked((int)0x80070057))
                        {
                            throw;
                        }
                        // 0x80070057 - "Value does not fall within the expected range." is returned from 
                        // GetAssemblyIdentityFromFile for WinMD components
                    }
                }
                return identity;
            }
        }
Example #25
0
        internal static void UpdateEntryPoint(string inputPath, string outputPath, string updatedApplicationPath, string applicationManifestPath, string targetFrameworkVersion)
        {
            XmlDocument       document   = new XmlDocument();
            XmlReaderSettings xrSettings = new XmlReaderSettings();

            xrSettings.DtdProcessing = DtdProcessing.Ignore;
            using (XmlReader xr = XmlReader.Create(inputPath, xrSettings))
            {
                document.Load(xr);
            }
            XmlNamespaceManager nsmgr       = XmlNamespaces.GetNamespaceManager(document.NameTable);
            AssemblyIdentity    appManifest = AssemblyIdentity.FromManifest(applicationManifestPath);

            // update path to application manifest
            XmlNode codeBaseNode = null;

            foreach (string xpath in XPaths.codebasePaths)
            {
                codeBaseNode = document.SelectSingleNode(xpath, nsmgr);
                if (codeBaseNode != null)
                {
                    break;
                }
            }
            if (codeBaseNode == null)
            {
                throw new InvalidOperationException(String.Format(System.Globalization.CultureInfo.InvariantCulture, "XPath not found: {0}", XPaths.codebasePaths[0]));
            }

            codeBaseNode.Value = updatedApplicationPath;

            // update Public key token of application manifest
            XmlNode publicKeyTokenNode = ((XmlAttribute)codeBaseNode).OwnerElement.SelectSingleNode(XPaths.dependencyPublicKeyTokenAttribute, nsmgr);

            if (publicKeyTokenNode == null)
            {
                throw new InvalidOperationException(String.Format(System.Globalization.CultureInfo.InvariantCulture, "XPath not found: {0}", XPaths.dependencyPublicKeyTokenAttribute));
            }

            publicKeyTokenNode.Value = appManifest.PublicKeyToken;

            // update hash of application manifest
            string hash;
            long   size;

            Util.GetFileInfo(applicationManifestPath, targetFrameworkVersion, out hash, out size);

            // Hash node may not be present with optional signing
            XmlNode hashNode = ((XmlAttribute)codeBaseNode).OwnerElement.SelectSingleNode(XPaths.hashElement, nsmgr);

            if (hashNode != null)
            {
                ((XmlElement)hashNode).InnerText = hash;
            }

            // update file size of application manifest
            XmlAttribute sizeAttribute = ((XmlAttribute)codeBaseNode).OwnerElement.Attributes[XmlUtil.TrimPrefix(XPaths.fileSizeAttribute)];

            if (sizeAttribute == null)
            {
                throw new InvalidOperationException(String.Format(System.Globalization.CultureInfo.InvariantCulture, "XPath not found: {0}", XPaths.fileSizeAttribute));
            }

            sizeAttribute.Value = size.ToString(System.Globalization.CultureInfo.InvariantCulture);

            document.Save(outputPath);
        }
Example #26
0
 internal static bool IsEqual(AssemblyIdentity a1, AssemblyIdentity a2, bool specificVersion)
 {
     if (a1 == null || a2 == null)
         return false;
     if (specificVersion)
         return String.Equals(a1._name, a2._name, StringComparison.OrdinalIgnoreCase)
             && String.Equals(a1._publicKeyToken, a2._publicKeyToken, StringComparison.OrdinalIgnoreCase)
             && String.Equals(a1._version, a2._version, StringComparison.OrdinalIgnoreCase)
             && String.Equals(a1._culture, a2._culture, StringComparison.OrdinalIgnoreCase)
             && String.Equals(a1._processorArchitecture, a2._processorArchitecture, StringComparison.OrdinalIgnoreCase);
     else
         return String.Equals(a1._name, a2._name, StringComparison.OrdinalIgnoreCase);
 }
 internal static bool IsEqual(AssemblyIdentity a1, AssemblyIdentity a2, bool specificVersion)
 {
     if ((a1 == null) || (a2 == null))
     {
         return false;
     }
     if (!specificVersion)
     {
         return string.Equals(a1.name, a2.name, StringComparison.OrdinalIgnoreCase);
     }
     return (((string.Equals(a1.name, a2.name, StringComparison.OrdinalIgnoreCase) && string.Equals(a1.publicKeyToken, a2.publicKeyToken, StringComparison.OrdinalIgnoreCase)) && (string.Equals(a1.version, a2.version, StringComparison.OrdinalIgnoreCase) && string.Equals(a1.culture, a2.culture, StringComparison.OrdinalIgnoreCase))) && string.Equals(a1.processorArchitecture, a2.processorArchitecture, StringComparison.OrdinalIgnoreCase));
 }
        private AssemblyIdentity CreateAssemblyIdentity(AssemblyIdentity baseIdentity, AssemblyIdentity entryPointIdentity)
        {
            string name = _assemblyName;
            string version = _assemblyVersion;
            string publicKeyToken = "0000000000000000";
            string culture = _targetCulture;

            if (String.IsNullOrEmpty(name))
            {
                if (baseIdentity != null && !String.IsNullOrEmpty(baseIdentity.Name))
                    name = baseIdentity.Name;
                else if (entryPointIdentity != null && !String.IsNullOrEmpty(entryPointIdentity.Name))
                {
                    if (_manifest is DeployManifest)
                        name = Path.GetFileNameWithoutExtension(entryPointIdentity.Name) + ".application";
                    else if (_manifest is ApplicationManifest)
                        name = entryPointIdentity.Name + ".exe";
                }
            }
            if (String.IsNullOrEmpty(name))
            {
                Log.LogErrorWithCodeFromResources("GenerateManifest.NoIdentity");
                return null;
            }

            if (String.IsNullOrEmpty(version))
            {
                if (baseIdentity != null && !String.IsNullOrEmpty(baseIdentity.Version))
                    version = baseIdentity.Version;
                else if (entryPointIdentity != null && !String.IsNullOrEmpty(entryPointIdentity.Version))
                    version = entryPointIdentity.Version;
            }
            if (String.IsNullOrEmpty(version))
                version = "1.0.0.0";

            if (String.IsNullOrEmpty(culture))
            {
                if (baseIdentity != null && !String.IsNullOrEmpty(baseIdentity.Culture))
                    culture = baseIdentity.Culture;
                else if (entryPointIdentity != null && !String.IsNullOrEmpty(entryPointIdentity.Culture))
                    culture = entryPointIdentity.Culture;
            }
            if (String.IsNullOrEmpty(culture)
             || String.Equals(culture, "neutral", StringComparison.OrdinalIgnoreCase)
             || String.Equals(culture, "*", StringComparison.OrdinalIgnoreCase))
                culture = "neutral";

            if (String.IsNullOrEmpty(_processorArchitecture))
            {
                if (baseIdentity != null && !String.IsNullOrEmpty(baseIdentity.ProcessorArchitecture))
                    _processorArchitecture = baseIdentity.ProcessorArchitecture;
                else if (entryPointIdentity != null && !String.IsNullOrEmpty(entryPointIdentity.ProcessorArchitecture))
                    _processorArchitecture = entryPointIdentity.ProcessorArchitecture;
            }
            if (String.IsNullOrEmpty(_processorArchitecture))
                _processorArchitecture = "msil";

            // Fixup for non-ClickOnce case...
            if (_manifest is ApplicationManifest)
            {
                ApplicationManifest applicationManifest = _manifest as ApplicationManifest;
                if (!applicationManifest.IsClickOnceManifest)
                {
                    // Don't need publicKeyToken attribute for non-ClickOnce case
                    publicKeyToken = null;
                    // Language attribute should be omitted if neutral
                    if (String.Compare(culture, "neutral", StringComparison.OrdinalIgnoreCase) == 0)
                        culture = null;
                    // WinXP loader doesn't understand "msil"
                    if (String.Compare(_processorArchitecture, "msil", StringComparison.OrdinalIgnoreCase) == 0)
                        _processorArchitecture = null;
                }
            }

            return new AssemblyIdentity(name, version, publicKeyToken, culture, _processorArchitecture);
        }
Example #29
0
 private void UpdateEntryPoint()
 {
     if (_entryPoint != null)
     {
         _entryPointIdentity = new AssemblyIdentity(_entryPoint.AssemblyIdentity);
         _entryPointPath = _entryPoint.TargetPath;
     }
     else
     {
         _entryPointIdentity = null;
         _entryPointPath = null;
     }
 }