private static bool CreateManifestFile(Container container, out string errorString)
        {
            // Add other file references
            ReferenceUtils.AddAssemblyReferences(container);

            // Set TrustInfo property
            SetApplicationTrustInfo(container);

            // Set endpoint and assemblyIdentity (by the way its a similar things)
            SetApplicationEndpointIdentity(container);

            // Set global important settings
            FlowUtils.SetGlobals(container.Application, container);

            if (!InfoUtils.IsValidManifest(container.Application, out errorString))
            {
                return(false);
            }

            // Writing to file
            ManifestWriter.WriteManifest(
                container.Application,
                container.Application.SourcePath,
                FlowUtils.GetTargetFramework(container));

            ProcessAfterSave(container.Application, container.Application.TargetFrameworkVersion);

            return(true);
        }
        /// <summary>
        /// Recreate base references.
        /// </summary>
        /// <param name="container">Container instance.</param>
        /// <param name="errorString">Error text.</param>
        public static bool RecreateReferences(Container container, out string errorString)
        {
            new List <OutputMessageCollection> {
                container.Application.OutputMessages, container.Deploy.OutputMessages
            }
            .ForEach(item => item.Clear());

            if (!InfoUtils.IsRequiredFieldsFilled(container, out errorString) ||
                !CreateManifestFile(container, out errorString) || !CreateDeployFile(container, out errorString))
            {
                return(false);
            }

            if (container.Deploy.MapFileExtensions)
            {
                FlowUtils.AddDeployExtention(container.FullPath);
            }

            return(true);
        }
        private static bool CreateDeployFile(Container container, out string errorString)
        {
            DeployManifest deploy = container.Deploy;

            // Set deploy entry point identity
            SetDeployEntrypointIdentity(container);

            // Set AssemblyReferences
            AddManifestReference(container);

            // Set global important settings
            FlowUtils.SetGlobals(container.Deploy, container);

            if (!InfoUtils.IsValidManifest(deploy, out errorString))
            {
                return(false);
            }

            // Writing to file
            ManifestWriter.WriteManifest(deploy, deploy.SourcePath, FlowUtils.GetTargetFramework(container));

            ProcessAfterSave(deploy, container.Application.TargetFrameworkVersion);
            return(true);
        }