Пример #1
0
        public override bool Execute()
        {
            if (LauncherPath == null)
            {
                // Launcher lives next to ClickOnce bootstrapper.
                // GetDefaultPath obtains the root ClickOnce boostrapper path.
                LauncherPath = Path.Combine(
                    Microsoft.Build.Tasks.Deployment.Bootstrapper.Util.GetDefaultPath(VisualStudioVersion),
                    ENGINE_PATH,
                    LAUNCHER_EXE);
            }

            if (EntryPoint == null)
            {
                Log.LogErrorWithCodeFromResources("GenerateLauncher.InvalidInput");
                return(false);
            }

            var    launcherBuilder    = new LauncherBuilder(LauncherPath);
            string entryPointFileName = Path.GetFileName(EntryPoint.ItemSpec);

            //
            // If the EntryPoint specified is apphost.exe, we need to use the assemblyname instead since
            // apphost.exe is the source file that will get copied to outdir as {assemblyname}.exe.
            //
            if (entryPointFileName.Equals(Constants.AppHostExe, StringComparison.InvariantCultureIgnoreCase) &&
                !String.IsNullOrEmpty(AssemblyName))
            {
                entryPointFileName = AssemblyName;
            }
            BuildResults results = launcherBuilder.Build(entryPointFileName, OutputPath);

            BuildMessage[] messages = results.Messages;
            if (messages != null)
            {
                foreach (BuildMessage message in messages)
                {
                    switch (message.Severity)
                    {
                    case BuildMessageSeverity.Error:
                        Log.LogError(null, message.HelpCode, message.HelpKeyword, null, 0, 0, 0, 0, message.Message);
                        break;

                    case BuildMessageSeverity.Warning:
                        Log.LogWarning(null, message.HelpCode, message.HelpKeyword, null, 0, 0, 0, 0, message.Message);
                        break;

                    case BuildMessageSeverity.Info:
                        Log.LogMessage(null, message.HelpCode, message.HelpKeyword, null, 0, 0, 0, 0, message.Message);
                        continue;
                    }
                }
            }

            OutputEntryPoint = new TaskItem(Path.Combine(Path.GetDirectoryName(EntryPoint.ItemSpec), results.KeyFile));
            OutputEntryPoint.SetMetadata(ItemMetadataNames.targetPath, results.KeyFile);

            return(!Log.HasLoggedErrors);
        }
Пример #2
0
        void DecompileMe_AllComplated1(object sender, EventArgs e)
        {
            string launcherName = Path.GetFileName(AssInfo.ExeFileName);

            launcherName = launcherName.Substring(0, launcherName.LastIndexOf("."));
            LauncherBuilder lbl = new LauncherBuilder(SoftConfig.CplusplusIncludePath, SoftConfig.CplusplusCLPath, launcherName, txtBuildPath.Text);

            lbl.RunBuild(); //because some problem,so we don't add pro to c++ header
            lbl.DoFiles();
            DecompileMe_Progress("All Complete", 100);
            IsCanCloseNow = true;
        }