Beispiel #1
0
        private Button CreatePublishButton(MsBuildCommand msBuild)
        {
            var publishButton = Clone(PublishButtonTemplate);

            publishButton.Enabled = false; //disable publish for now
            publishButton.Font    = new Font(publishButton.Font, FontStyle.Strikeout);

            publishButton.Click += async(sender, args) =>
            {
                try
                {
                    publishButton.Enabled   = false;
                    publishButton.Text      = "Working";
                    publishButton.BackColor = Color.LightGoldenrodYellow;
                    await Task.Run(msBuild.Publish);

                    publishButton.BackColor = PublishButtonTemplate.BackColor;
                }
                catch (Exception)
                {
                    publishButton.BackColor = Color.LightCoral;
                }
                finally
                {
                    publishButton.Text    = PublishButtonTemplate.Text;
                    publishButton.Enabled = true;
                }
            };
            return(publishButton);
        }
Beispiel #2
0
        private Button CreateDbDeployButton(MsBuildCommand msBuild)
        {
            var dbDeployButton = Clone(DBDeployButtonTemplate);

            if (msBuild.DbFileNotFound())
            {
                dbDeployButton.Enabled = false;
                dbDeployButton.Font    = new Font(dbDeployButton.Font, FontStyle.Strikeout);
            }
            else
            {
                dbDeployButton.Click += async(sender, args) =>
                {
                    try
                    {
                        dbDeployButton.Enabled   = false;
                        dbDeployButton.Text      = "Working";
                        dbDeployButton.BackColor = Color.LightGoldenrodYellow;
                        await Task.Run(msBuild.DbDeploy);

                        dbDeployButton.BackColor = DBDeployButtonTemplate.BackColor;
                    }
                    catch (Exception)
                    {
                        dbDeployButton.BackColor = Color.LightCoral;
                    }
                    finally
                    {
                        dbDeployButton.Text    = DBDeployButtonTemplate.Text;
                        dbDeployButton.Enabled = true;
                    }
                };
            }
            return(dbDeployButton);
        }
Beispiel #3
0
        private void AddRepo(Repository repo)
        {
            var git     = new GitCommand(_settings, repo);
            var msbuild = new MsBuildCommand(_settings, repo);

            var statusLabel    = Clone(StatusLabelTemplate);
            var branchLabel    = Clone(BranchLabelTemplate);
            var localPathLabel = Clone(LocalPathLabelTemplate);

            localPathLabel.Text = repo.LocalPath;

            var fetchButton    = CreateFetchButton(git);
            var syncButton     = CreateSyncButton(git);
            var publishButton  = CreatePublishButton(msbuild);
            var dbDeployButton = CreateDbDeployButton(msbuild);
            var viewLogButton  = CreateViewRepoLogButton(repo);

            AddRefreshRepoLabels(fetchButton, branchLabel, statusLabel, git);
            AddRefreshRepoLabels(syncButton, branchLabel, statusLabel, git);
            AddRefreshRepoLabels(publishButton, branchLabel, statusLabel, git);
            AddRefreshRepoLabels(dbDeployButton, branchLabel, statusLabel, git);
            AddRefreshRepoLabels(viewLogButton, branchLabel, statusLabel, git);
            AddRefreshRepoLabels(statusLabel, branchLabel, statusLabel, git);
            AddRefreshRepoLabels(branchLabel, branchLabel, statusLabel, git);
            AddRefreshRepoLabels(statusLabel, branchLabel, statusLabel, git);

            RepoPanel.Controls.Add(fetchButton);
            RepoPanel.Controls.Add(syncButton);
            RepoPanel.Controls.Add(publishButton);
            RepoPanel.Controls.Add(dbDeployButton);
            RepoPanel.Controls.Add(viewLogButton);
            RepoPanel.Controls.Add(localPathLabel);
            RepoPanel.Controls.Add(branchLabel);
            RepoPanel.Controls.Add(statusLabel);
        }
Beispiel #4
0
        private void 编译ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (griddev.CurrentCell == null)
            {
                return;
            }
            string retmsg = "";

            try
            {
                List <PluginClass> plist = griddev.DataSource as List <PluginClass>;
                PluginClass        pc    = plist[griddev.CurrentCell.RowIndex];
                FileInfo           file  = null;
                if (pc.plugintype == "WinformModulePlugin" || pc.plugintype == "WcfModulePlugin")
                {
                    file = new FileInfo(CommonHelper.WinformPlatformPath + "\\" + pc.path);
                }
                else if (pc.plugintype == "WebModulePlugin")
                {
                    file = new FileInfo(CommonHelper.WebPlatformPath + "\\" + pc.path);
                }
                string slnpath = file.Directory.FullName + "\\EFW_" + pc.name + ".sln";
                retmsg = MsBuildCommand.Build(slnpath);

                loadTitle();
                MessageBoxEx.Show("编译成功!\r\n", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception err)
            {
                MessageBoxEx.Show("编译失败!\r\n" + err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #5
0
        public void TestWebBuild()
        {
            var setting = new CompileSetting
            {
                BuildConfiguration = "Release",
                IsWeb = true,
                ProjectPath = ProjectPath,
                OutputDirectory = "PublishFolder/Web"
            };

            var target = new MsBuildCommand(setting);
            var executeSetting = new ExecuteSetting("./");
            var arguments = target.BuildArguments(executeSetting);
            var expected = "\"" + ProjectPath +
                           @""" /p:Configuration=Release;WebProjectOutputDir=""./PublishFolder/Web"" /t:_CopyWebApplication;_WPPCopyWebApplication;TransformWebConfig";
            Assert.AreEqual(expected, arguments);
        }
Beispiel #6
0
        public void WebBuild_Release()
        {
            var webFolder = Path.Combine(Environment.CurrentDirectory, "PublishFolder", "web");
            var setting = new CompileSetting
            {
                BuildConfiguration = "Release",
                IsWeb = true,
                ProjectPath = ProjectPath,
                BuildLogFile = false
                //OutputDirectory = "PublishFolder/Web"
            };

            var msbuild = new MsBuildCommand(setting);
            var executeSetting = new ExecuteSetting("./");
            var arguments = msbuild.BuildArguments(executeSetting);

            Assert.AreEqual(
                @"""" + ProjectPath + @""" /p:Configuration=Release /t:_CopyWebApplication;_WPPCopyWebApplication;TransformWebConfig",
                arguments);
        }