예제 #1
0
        internal static void Build(Project project)
        {
            var application = new ApplicationManifest
            {
                IsClickOnceManifest    = true,
                ReadOnly               = false,
                IconFile               = project.IconFile.Value,
                OSVersion              = project.OsVersion.Value,
                OSDescription          = project.OsDescription.Value,
                OSSupportUrl           = project.OsSupportUrl.Value,
                TargetFrameworkVersion = project.TargetFramework.Version,
                HostInBrowser          = project.LaunchMode.Value == LaunchMode.Browser,
                AssemblyIdentity       = new AssemblyIdentity
                {
                    Name    = Path.GetFileName(project.EntryPoint.Value),
                    Version = project.Version.Value,
                    Culture = project.Culture.Value,
                    ProcessorArchitecture = project.ProcessorArchitecture.Value.ToString().ToLowerInvariant()
                },
                UseApplicationTrust = project.UseApplicationTrust.Value,
                TrustInfo           = project.TrustInfo.Resolve()
            };

            if (project.UseApplicationTrust.Value)
            {
                application.Publisher      = project.Publisher.Value;
                application.SuiteName      = project.Suite.Value;
                application.Product        = project.Product.Value;
                application.SupportUrl     = project.SupportUrl.Value;
                application.ErrorReportUrl = project.ErrorUrl.Value;
                application.Description    = project.Description.Value;
            }

            application.AddEntryPoint(project);
            application.AddIconFile(project);
            application.AddGlob(project, project.Assemblies);
            application.AddGlob(project, project.DataFiles);
            application.AddGlob(project, project.Files);
            application.AddFileAssociations(project);

            application.ResolveFiles();
            application.UpdateFileInfo(project.TargetFramework.Version);

            Logger.Normal(Messages.Build_Process_Application);
            application.Validate();
            Logger.OutputMessages(application.OutputMessages, 1);

            if (!project.PackageMode.Value.HasFlag(PackageMode.Application))
            {
                return;
            }

            Directory.CreateDirectory(Path.GetDirectoryName(project.ApplicationManifestFile.RootedPath));
            ManifestWriter.WriteManifest(application, project.ApplicationManifestFile.RootedPath, project.TargetFramework.Version);
            var signed = Utilities.Sign(project.ApplicationManifestFile.RootedPath, project);

            Logger.Normal(Messages.Build_Process_Manifest, 1, 1, project.ApplicationManifestFile.RootedPath);
            if (signed)
            {
                Logger.Normal(Messages.Build_Process_Manifest_Signed, 1);
            }
            Logger.Normal();
        }