Example #1
0
 public async Task ExecuteNupkgCmd()
 {
     try {
         var proj = SelectedFile as Project;
         if (proj == null)
         {
             MessageBox.Show($"File is not a .csproj or .vbproj", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         var outputPath = (await PreferenceService.GetSetting(Settings.NugetDefaultOutputPath))?.ValueString;
         var workingDir = Path.GetDirectoryName(proj.Path);
         var cmd        = "";
         if (OptionPack)
         {
             cmd = Nuget.Init().Pack(proj.Path).OutputDirectory(outputPath).Properties().Configuration().Out;
         }
         if (OptionRestore)
         {
         }
         await _runNuget.RunAsync(cmd, workingDir);
         await UpdateFilesData();
     } catch (Exception ex) {
         MessageBox.Show($"Execute Nupkg Cmd:\r\n{ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #2
0
 public string NugetDeleteTest()
 {
     return(Nuget.Init()
            .Delete(@"NuCLIus.Services")
            .PackageVersion("1.0.0")
            .Source(@"\\localnugetserver")
            .Out);
 }
Example #3
0
 public string NugetAddTest()
 {
     return(Nuget.Init()
            .Add(@"..\..\..\..\NuCLIus.Services\NuCLIus.Services.1.0.0.nupkg")
            .VerbosityAdd(NugetVerbosityLevels.Normal)
            .Source(@"\\localnugetserver")
            .Out);
 }
Example #4
0
        public async Task NugetPackTest(string desc, bool doExecute)
        {
            var cmd = Nuget.Init()
                      .Pack(@"..\..\..\..\NuCLIus.Services\NuCLIus.Services.csproj")
                      .OutputDirectory("E:\\NuCLIusTests", createIfNotExists: true)
                      .Properties()
                      .Configuration()
                      .Out;

            Debug.WriteLine(cmd);
            run.GetCmdStandardOutput += (s, stdout) => {
                Debug.WriteLine(stdout);
            };
            if (doExecute)
            {
                await run.RunAsync(cmd);
            }
            Assert.IsTrue(cmd == @"nuget pack ..\..\..\..\NuCLIus.Services\NuCLIus.Services.csproj " +
                          @"-OutputDirectory E:\NuCLIusTests -Properties Configuration=Release");
        }
Example #5
0
        public async Task ExecutePackageCmd()
        {
            try {
                var nupkg = (SelectedFile as Nupkg)?.DetermineNugetInfo();
                if (nupkg == null)
                {
                    MessageBox.Show($"File is not a .nupkg", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                var nugetSrv = await PreferenceService.GetSetting(Settings.NugetLocalNugetServer);

                if (string.IsNullOrWhiteSpace(nugetSrv.ValueString) || !Directory.Exists(nugetSrv.ValueString))
                {
                    MessageBox.Show($"No local nuget server specified in settings", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                var cmd        = "";
                var workingDir = Path.GetDirectoryName(nupkg.Path);
                if (OptionAddNupkg)
                {
                    cmd = Nuget.Init().Add(nupkg.Path).Source(nugetSrv.ValueString).Out;
                }
                if (OptionDelete)
                {
                    cmd = Nuget.Init().Delete(nupkg.PackageName).PackageVersion(nupkg.Version).Source(nugetSrv.ValueString).Out;
                }
                if (OptionList)
                {
                }
                await _runNuget.RunAsync(cmd, workingDir);
                await UpdateFilesData();
            } catch (Exception ex) {
                MessageBox.Show($"Execute Package Cmd:\r\n{ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }