private void ValidateEntryPoint()
 {
     if (this.entryPoint != null)
     {
         if (!string.IsNullOrEmpty(this.entryPoint.TargetPath) && !this.entryPoint.TargetPath.EndsWith(".manifest", StringComparison.OrdinalIgnoreCase))
         {
             base.OutputMessages.AddErrorMessage("GenerateManifest.InvalidEntryPoint", new string[] { this.entryPoint.ToString() });
         }
         string resolvedPath = this.entryPoint.ResolvedPath;
         if (resolvedPath == null)
         {
             resolvedPath = Path.Combine(Path.GetDirectoryName(base.SourcePath), this.entryPoint.TargetPath);
         }
         if (File.Exists(resolvedPath))
         {
             ApplicationManifest manifest = ManifestReader.ReadManifest(resolvedPath, false) as ApplicationManifest;
             if (manifest != null)
             {
                 if (this.Install)
                 {
                     if (manifest.HostInBrowser)
                     {
                         base.OutputMessages.AddErrorMessage("GenerateManifest.HostInBrowserNotOnlineOnly", new string[0]);
                     }
                 }
                 else if ((manifest.FileAssociations != null) && (manifest.FileAssociations.Count > 0))
                 {
                     base.OutputMessages.AddErrorMessage("GenerateManifest.FileAssociationsNotInstalled", new string[0]);
                 }
             }
         }
     }
 }
Exemple #2
0
        private void ValidateEntryPoint()
        {
            if (_entryPoint != null)
            {
                if (!String.IsNullOrEmpty(_entryPoint.TargetPath) && !_entryPoint.TargetPath.EndsWith(".manifest", StringComparison.OrdinalIgnoreCase))
                {
                    OutputMessages.AddErrorMessage("GenerateManifest.InvalidEntryPoint", _entryPoint.ToString());
                }

                string ManifestPath = _entryPoint.ResolvedPath;
                if (ManifestPath == null)
                {
                    ManifestPath = Path.Combine(Path.GetDirectoryName(SourcePath), _entryPoint.TargetPath);
                }
                if (File.Exists(ManifestPath))
                {
                    ApplicationManifest entryPointManifest = ManifestReader.ReadManifest(ManifestPath, false) as ApplicationManifest;
                    if (entryPointManifest != null)
                    {
                        if (Install)
                        {
                            if (entryPointManifest.HostInBrowser)
                            {
                                OutputMessages.AddErrorMessage("GenerateManifest.HostInBrowserNotOnlineOnly");
                            }
                        }
                        else
                        {
                            if (entryPointManifest.FileAssociations != null && entryPointManifest.FileAssociations.Count > 0)
                            {
                                OutputMessages.AddErrorMessage("GenerateManifest.FileAssociationsNotInstalled");
                            }
                        }
                    }
                }
            }
        }
Exemple #3
0
        private void ValidateCom()
        {
            int    tickCount = Environment.TickCount;
            string fileName  = Path.GetFileName(base.SourcePath);
            Dictionary <string, ComInfo> dictionary  = new Dictionary <string, ComInfo>();
            Dictionary <string, ComInfo> dictionary2 = new Dictionary <string, ComInfo>();

            foreach (AssemblyReference reference in base.AssemblyReferences)
            {
                if (((reference.ReferenceType == AssemblyReferenceType.NativeAssembly) && !reference.IsPrerequisite) && !string.IsNullOrEmpty(reference.ResolvedPath))
                {
                    ComInfo[] comInfo = ManifestReader.GetComInfo(reference.ResolvedPath);
                    if (comInfo != null)
                    {
                        foreach (ComInfo info in comInfo)
                        {
                            if (!string.IsNullOrEmpty(info.ClsId))
                            {
                                string key = info.ClsId.ToLowerInvariant();
                                if (!dictionary.ContainsKey(key))
                                {
                                    dictionary.Add(key, info);
                                }
                                else
                                {
                                    base.OutputMessages.AddErrorMessage("GenerateManifest.DuplicateComDefinition", new string[] { "clsid", info.ComponentFileName, info.ClsId, info.ManifestFileName, dictionary[key].ManifestFileName });
                                }
                            }
                            if (!string.IsNullOrEmpty(info.TlbId))
                            {
                                string str3 = info.TlbId.ToLowerInvariant();
                                if (!dictionary2.ContainsKey(str3))
                                {
                                    dictionary2.Add(str3, info);
                                }
                                else
                                {
                                    base.OutputMessages.AddErrorMessage("GenerateManifest.DuplicateComDefinition", new string[] { "tlbid", info.ComponentFileName, info.TlbId, info.ManifestFileName, dictionary2[str3].ManifestFileName });
                                }
                            }
                        }
                    }
                }
            }
            foreach (FileReference reference2 in base.FileReferences)
            {
                if (reference2.ComClasses != null)
                {
                    foreach (ComClass class2 in reference2.ComClasses)
                    {
                        string str4 = class2.ClsId.ToLowerInvariant();
                        if (!dictionary.ContainsKey(str4))
                        {
                            dictionary.Add(str4, new ComInfo(fileName, reference2.TargetPath, class2.ClsId, null));
                        }
                        else
                        {
                            base.OutputMessages.AddErrorMessage("GenerateManifest.DuplicateComDefinition", new string[] { "clsid", reference2.ToString(), class2.ClsId, fileName, dictionary[str4].ManifestFileName });
                        }
                    }
                }
                if (reference2.TypeLibs != null)
                {
                    foreach (TypeLib lib in reference2.TypeLibs)
                    {
                        string str5 = lib.TlbId.ToLowerInvariant();
                        if (!dictionary2.ContainsKey(str5))
                        {
                            dictionary2.Add(str5, new ComInfo(fileName, reference2.TargetPath, null, lib.TlbId));
                        }
                        else
                        {
                            base.OutputMessages.AddErrorMessage("GenerateManifest.DuplicateComDefinition", new string[] { "tlbid", reference2.ToString(), lib.TlbId, fileName, dictionary2[str5].ManifestFileName });
                        }
                    }
                }
            }
            Util.WriteLog(string.Format(CultureInfo.CurrentCulture, "GenerateManifest.CheckForComDuplicates t={0}", new object[] { Environment.TickCount - tickCount }));
        }
Exemple #4
0
        private void ValidateCom()
        {
            int    t1             = Environment.TickCount;
            string outputFileName = Path.GetFileName(SourcePath);
            Dictionary <string, ComInfo> clsidList = new Dictionary <string, ComInfo>();
            Dictionary <string, ComInfo> tlbidList = new Dictionary <string, ComInfo>();

            // Check for duplicate COM definitions in all dependent manifests...
            foreach (AssemblyReference assembly in AssemblyReferences)
            {
                if (assembly.ReferenceType == AssemblyReferenceType.NativeAssembly && !assembly.IsPrerequisite && !String.IsNullOrEmpty(assembly.ResolvedPath))
                {
                    ComInfo[] comInfoArray = ManifestReader.GetComInfo(assembly.ResolvedPath);;
                    if (comInfoArray != null)
                    {
                        foreach (ComInfo comInfo in comInfoArray)
                        {
                            if (!String.IsNullOrEmpty(comInfo.ClsId))
                            {
                                string key = comInfo.ClsId.ToLowerInvariant();
                                if (!clsidList.ContainsKey(key))
                                {
                                    clsidList.Add(key, comInfo);
                                }
                                else
                                {
                                    OutputMessages.AddErrorMessage("GenerateManifest.DuplicateComDefinition", "clsid", comInfo.ComponentFileName, comInfo.ClsId, comInfo.ManifestFileName, clsidList[key].ManifestFileName);
                                }
                            }
                            if (!String.IsNullOrEmpty(comInfo.TlbId))
                            {
                                string key = comInfo.TlbId.ToLowerInvariant();
                                if (!tlbidList.ContainsKey(key))
                                {
                                    tlbidList.Add(key, comInfo);
                                }
                                else
                                {
                                    OutputMessages.AddErrorMessage("GenerateManifest.DuplicateComDefinition", "tlbid", comInfo.ComponentFileName, comInfo.TlbId, comInfo.ManifestFileName, tlbidList[key].ManifestFileName);
                                }
                            }
                        }
                    }
                }
            }

            // Check for duplicate COM definitions in the manifest about to be generated...
            foreach (FileReference file in FileReferences)
            {
                if (file.ComClasses != null)
                {
                    foreach (ComClass comClass in file.ComClasses)
                    {
                        string key = comClass.ClsId.ToLowerInvariant();
                        if (!clsidList.ContainsKey(key))
                        {
                            clsidList.Add(key, new ComInfo(outputFileName, file.TargetPath, comClass.ClsId, null));
                        }
                        else
                        {
                            OutputMessages.AddErrorMessage("GenerateManifest.DuplicateComDefinition", "clsid", file.ToString(), comClass.ClsId, outputFileName, clsidList[key].ManifestFileName);
                        }
                    }
                }
                if (file.TypeLibs != null)
                {
                    foreach (TypeLib typeLib in file.TypeLibs)
                    {
                        string key = typeLib.TlbId.ToLowerInvariant();
                        if (!tlbidList.ContainsKey(key))
                        {
                            tlbidList.Add(key, new ComInfo(outputFileName, file.TargetPath, null, typeLib.TlbId));
                        }
                        else
                        {
                            OutputMessages.AddErrorMessage("GenerateManifest.DuplicateComDefinition", "tlbid", file.ToString(), typeLib.TlbId, outputFileName, tlbidList[key].ManifestFileName);
                        }
                    }
                }
            }

            Util.WriteLog(String.Format(CultureInfo.CurrentCulture, "GenerateManifest.CheckForComDuplicates t={0}", Environment.TickCount - t1));
        }