/// <summary>
        /// Task entry point
        /// </summary>
        /// <returns></returns>
        public override bool Execute()
        {
            AssemblyRegistrationCache cacheFile;

            if (AssemblyListFile != null)
            {
                cacheFile = (AssemblyRegistrationCache)StateFileBase.DeserializeCache(AssemblyListFile.ItemSpec, Log, typeof(AssemblyRegistrationCache));

                // no cache file, nothing to do. In case there was a problem reading the cache file, we can't do anything anyway.
                if (cacheFile == null)
                {
                    StateFileBase.DeleteFile(AssemblyListFile.ItemSpec, Log);
                    return(true);
                }
            }
            else
            {
                if (Assemblies == null)
                {
                    Log.LogErrorWithCodeFromResources("UnregisterAssembly.AssemblyPathOrStateFileIsRequired", GetType().Name);
                    return(false);
                }

                // TypeLibFiles isn't [Required], but if it is specified, it must have the same length as Assemblies
                if (TypeLibFiles != null && TypeLibFiles.Length != Assemblies.Length)
                {
                    Log.LogErrorWithCodeFromResources("General.TwoVectorsMustHaveSameLength", Assemblies.Length, TypeLibFiles.Length, "Assemblies", "TypeLibFiles");
                    return(false);
                }

                cacheFile = new AssemblyRegistrationCache();

                for (int i = 0; i < Assemblies.Length; i++)
                {
                    // if the type lib path is not supplied, generate default one
                    if (TypeLibFiles != null && TypeLibFiles[i] != null && TypeLibFiles[i].ItemSpec.Length > 0)
                    {
                        cacheFile.AddEntry(Assemblies[i].ItemSpec, TypeLibFiles[i].ItemSpec);
                    }
                    else
                    {
                        cacheFile.AddEntry(Assemblies[i].ItemSpec, Path.ChangeExtension(Assemblies[i].ItemSpec, ".tlb"));
                    }
                }
            }

            bool taskReturnValue = true;

            try
            {
                for (int i = 0; i < cacheFile.Count; i++)
                {
                    cacheFile.GetEntry(i, out string assemblyPath, out string typeLibraryPath);

                    try
                    {
                        // If one of assemblies failed to unregister, the whole task failed.
                        // We still process the rest of assemblies though.
                        if (!Unregister(assemblyPath, typeLibraryPath))
                        {
                            taskReturnValue = false;
                        }
                    }
                    catch (ArgumentException ex) // assembly path has invalid chars in it
                    {
                        Log.LogErrorWithCodeFromResources("General.InvalidAssemblyName", assemblyPath, ex.Message);
                        taskReturnValue = false;
                    }
#if _DEBUG
                    catch (Exception e)
                    {
                        Debug.Assert(false, "Unexpected exception in AssemblyRegistration.Execute. " +
                                     "Please log a MSBuild bug specifying the steps to reproduce the problem. " +
                                     e.Message);
                        throw;
                    }
#endif
                }
            }
            finally
            {
                if (AssemblyListFile != null)
                {
                    StateFileBase.DeleteFile(AssemblyListFile.ItemSpec, Log);
                }
            }

            return(taskReturnValue);
        }
        public override bool Execute()
        {
            AssemblyRegistrationCache cache = null;

            if (this.AssemblyListFile != null)
            {
                cache = (AssemblyRegistrationCache)StateFileBase.DeserializeCache(this.AssemblyListFile.ItemSpec, base.Log, typeof(AssemblyRegistrationCache));
                if (cache == null)
                {
                    StateFileBase.DeleteFile(this.AssemblyListFile.ItemSpec, base.Log);
                    return(true);
                }
            }
            else
            {
                if (this.Assemblies == null)
                {
                    base.Log.LogErrorWithCodeFromResources("UnregisterAssembly.AssemblyPathOrStateFileIsRequired", new object[] { base.GetType().Name });
                    return(false);
                }
                if ((this.TypeLibFiles != null) && (this.TypeLibFiles.Length != this.Assemblies.Length))
                {
                    base.Log.LogErrorWithCodeFromResources("General.TwoVectorsMustHaveSameLength", new object[] { this.Assemblies.Length, this.TypeLibFiles.Length, "Assemblies", "TypeLibFiles" });
                    return(false);
                }
                cache = new AssemblyRegistrationCache();
                for (int i = 0; i < this.Assemblies.Length; i++)
                {
                    if (((this.TypeLibFiles != null) && (this.TypeLibFiles[i] != null)) && (this.TypeLibFiles[i].ItemSpec.Length > 0))
                    {
                        cache.AddEntry(this.Assemblies[i].ItemSpec, this.TypeLibFiles[i].ItemSpec);
                    }
                    else
                    {
                        cache.AddEntry(this.Assemblies[i].ItemSpec, Path.ChangeExtension(this.Assemblies[i].ItemSpec, ".tlb"));
                    }
                }
            }
            bool flag = true;

            try
            {
                for (int j = 0; j < cache.Count; j++)
                {
                    string assemblyPath    = null;
                    string typeLibraryPath = null;
                    cache.GetEntry(j, out assemblyPath, out typeLibraryPath);
                    try
                    {
                        if (!this.Unregister(assemblyPath, typeLibraryPath))
                        {
                            flag = false;
                        }
                    }
                    catch (ArgumentException exception)
                    {
                        base.Log.LogErrorWithCodeFromResources("General.InvalidAssemblyName", new object[] { assemblyPath, exception.Message });
                        flag = false;
                    }
                }
            }
            finally
            {
                if (this.AssemblyListFile != null)
                {
                    StateFileBase.DeleteFile(this.AssemblyListFile.ItemSpec, base.Log);
                }
            }
            return(flag);
        }