private void Push()
        {
            var nugetExe = txtNugetPath.Text;
            var script   = new StringBuilder();
            var deployVM = _deployControl.ViewModel;

            if (deployVM.NuGetServer.Length > 0)
            {
                script.AppendLine();
                if (!string.IsNullOrWhiteSpace(deployVM.V2Login))
                {
                    script.AppendFormat(@"""{0}"" sources Add -Name ""{1}"" -Source ""{2}"" -Username ""{3}"" -Password ""{4}""", nugetExe, deployVM.NuGetServer, deployVM.NuGetServer, deployVM.V2Login, deployVM.ApiKey);
                    script.AppendFormat(@" || ""{0}"" sources Update -Name ""{1}"" -Source ""{2}"" -Username ""{3}"" -Password ""{4}""", nugetExe, deployVM.NuGetServer, deployVM.NuGetServer, deployVM.V2Login, deployVM.ApiKey);
                    script.AppendLine();
                }

                script.AppendFormat("\"{0}\" push \"{1}{4}.{5}.nupkg\" -source {2} {3}", nugetExe, _outputDir, deployVM.NuGetServer, deployVM.ApiKey,
                                    _metadata.Id, _metadata.Version);
            }

            if (chkSymbol.Checked && !string.IsNullOrWhiteSpace(deployVM.SymbolServer))
            {
                script.AppendLine();
                script.AppendFormat("nuget SetApiKey {0}", deployVM.ApiKey);
                script.AppendLine();
                script.AppendFormat("nuget push \"{0}{1}.{2}.symbols.nupkg\" -source {3}", _outputDir, _metadata.Id, _metadata.Version, deployVM.SymbolServer);
            }

            CmdUtil.RunCmd(script.ToString());

            ShowPackages();
        }
Beispiel #2
0
        private void Pack()
        {
            var nugetExe = txtNugetPath.Text;

            _outputDir = _outputDir.Replace("\\\\", "\\");
            var script = new StringBuilder();

            script.AppendFormat(
                @"""{0}"" pack ""{1}"" -Build -Version ""{2}"" -Properties  Configuration=Release -OutputDirectory ""{3} "" ", nugetExe,
                _project.FileName, _metadata.Version, _outputDir);

            if (chkForceEnglishOutput.Checked)
            {
                script.Append(" -ForceEnglishOutput ");
            }
            if (chkIncludeReferencedProjects.Checked)
            {
                script.Append(" -IncludeReferencedProjects ");
            }
            if (chkSymbol.Checked)
            {
                script.Append(" -Symbols ");
            }

            var deployVM = _deployControl.ViewModel;

            if (deployVM.NuGetServer.Length > 0)
            {
                script.AppendLine();
                if (!string.IsNullOrWhiteSpace(deployVM.V2Login))
                {
                    script.AppendFormat(@"""{0}"" sources Add -Name ""{1}"" -Source ""{2}"" -Username ""{3}"" -Password ""{4}""", nugetExe, deployVM.NuGetServer, deployVM.NuGetServer, deployVM.V2Login, deployVM.ApiKey);
                    script.AppendFormat(@" || ""{0}"" sources Update -Name ""{1}"" -Source ""{2}"" -Username ""{3}"" -Password ""{4}""", nugetExe, deployVM.NuGetServer, deployVM.NuGetServer, deployVM.V2Login, deployVM.ApiKey);
                    script.AppendLine();
                }

                script.AppendFormat("\"{0}\" push \"{1}{4}.{5}.nupkg\" -source {2} {3}", nugetExe, _outputDir, deployVM.NuGetServer, deployVM.ApiKey,
                                    _metadata.Id, _metadata.Version);
            }

            if (chkSymbol.Checked && !string.IsNullOrWhiteSpace(deployVM.SymbolServer))
            {
                script.AppendLine();
                script.AppendFormat("nuget SetApiKey {0}", deployVM.ApiKey);
                script.AppendLine();
                script.AppendFormat("nuget push \"{0}{1}.{2}.symbols.nupkg\" -source {3}", _outputDir, _metadata.Id, _metadata.Version, deployVM.SymbolServer);
            }

            CmdUtil.RunCmd(script.ToString());
        }
Beispiel #3
0
        private void Pack()
        {
            var nugetExe = txtNugetPath.Text;
            //_outputDir = _outputDir.Replace("\\\\", "\\"); //this statement cause a bug of network path,see https://github.com/cnsharp/nupack/issues/20
            var script = new StringBuilder();

            script.AppendFormat(
                @"""{0}"" pack ""{1}"" -Build -Version ""{2}"" -Properties  Configuration=Release -OutputDirectory ""{3}"" ", nugetExe,
                _project.FileName, _metadata.Version, _outputDir.TrimEnd('\\'));//nuget pack path shouldn't end with slash

            if (chkForceEnglishOutput.Checked)
            {
                script.Append(" -ForceEnglishOutput ");
            }
            if (chkIncludeReferencedProjects.Checked)
            {
                script.Append(" -IncludeReferencedProjects ");
            }
            if (chkSymbol.Checked)
            {
                script.Append(" -Symbols ");
            }

            var deployVM = _deployControl.ViewModel;

            if (deployVM.NuGetServer.Length > 0)
            {
                script.AppendLine();
                if (!string.IsNullOrWhiteSpace(deployVM.V2Login))
                {
                    script.AppendFormat(@"""{0}"" sources Add -Name ""{1}"" -Source ""{2}"" -Username ""{3}"" -Password ""{4}""", nugetExe, deployVM.NuGetServer, deployVM.NuGetServer, deployVM.V2Login, deployVM.ApiKey);
                    script.AppendFormat(@" || ""{0}"" sources Update -Name ""{1}"" -Source ""{2}"" -Username ""{3}"" -Password ""{4}""", nugetExe, deployVM.NuGetServer, deployVM.NuGetServer, deployVM.V2Login, deployVM.ApiKey);
                    script.AppendLine();
                }

                script.AppendFormat("\"{0}\" push \"{1}{4}.{5}.nupkg\" -source {2} {3}", nugetExe, _outputDir, deployVM.NuGetServer, deployVM.ApiKey,
                                    _metadata.Id, _metadata.Version);
            }

            if (chkSymbol.Checked && !string.IsNullOrWhiteSpace(deployVM.SymbolServer))
            {
                script.AppendLine();
                script.AppendFormat("\"{0}\" SetApiKey {1}", nugetExe, deployVM.ApiKey);
                script.AppendLine();
                script.AppendFormat("\"{0}\" push \"{1}{2}.{3}.symbols.nupkg\" -source {4}", nugetExe, _outputDir, _metadata.Id, _metadata.Version, deployVM.SymbolServer);
            }

            CmdUtil.RunCmd(script.ToString());
        }
        private bool Pack()
        {
            var script = new StringBuilder();

            script.AppendFormat(" \"{0}\" \"{1}\" /t:pack /p:Configuration=Release ", GetMsbuildPath(), _project.FileName);
            if (chkSymbol.Checked)
            {
                script.Append(" /p:IncludeSymbols=true ");
            }
            if (File.Exists(_nuspecFile))
            {
                script.AppendFormat(" /p:NuspecFile=\"{0}\" ", _nuspecFile);
            }
            CmdUtil.RunCmd(script.ToString());
            if (_metadata.Version.EndsWith(".*"))
            {
                var outputFileName = _project.Properties.Item("OutputFileName").Value.ToString();
                var outputFile     = Path.Combine(_releaseDir, outputFileName);
                _metadata.Version = FileVersionInfo.GetVersionInfo(outputFile).FileVersion;
            }
            var file = $"{_releaseDir}\\{_metadata.Id}.{_metadata.Version}.nupkg";

            return(File.Exists(file));
        }