private void Window_Loaded(object sender, RoutedEventArgs e) { var data = NugetServerHelper.Get(); tbAddress.Text = data.Address; tbKey.Text = data.Key; }
private void CbPublish_Checked(object sender, RoutedEventArgs e) { var nuget = NugetServerHelper.Get(); if (string.IsNullOrEmpty(nuget?.Address)) { ShowNugetServerDialog(); } }
/// <summary> ///生成nuget包 /// </summary> /// <param name="filePath"></param> /// <param name="serviceModel"></param> /// <param name="errorMsg"></param> /// <param name="resultDic"></param> /// <returns></returns> public static bool ExcuteClientNuget(string filePath, ServiceModel serviceModel, out string errorMsg, out string resultDic) { errorMsg = string.Empty; resultDic = string.Empty; if (!ExecuteClientDll(filePath, serviceModel, out errorMsg, out resultDic)) { return(false); } var fileName = new FileInfo(filePath).Name; // 生成nuget文件 var projDicPath = ThriftGlobal.GetProjDir(fileName); var thriftDllPath = Path.Combine(projDicPath, "bin", "thriftProj.dll"); var nuspecXml = GenUtilityAsync.GenNuspecXml(thriftDllPath, serviceModel.NugetId); if (string.IsNullOrEmpty(nuspecXml)) { errorMsg = "nuspec file gen error!!!"; return(false); } var nuspecFilePath = Path.Combine(resultDic, "Package.nuspec"); Utility.WriteNewFile(nuspecFilePath, nuspecXml); // 生成nuget包 var error = string.Empty; Utility.RunCmd(Utility.NugetExePath, "pack " + nuspecFilePath + " -OutputDirectory " + resultDic, out error); // 直接发布 if (serviceModel.Publish) { //var nugetServer = "http://10.0.60.89:8081"; //if (ThriftGlobal.GenAsyncVersion == EnumGenAsyncVersion.Old) // nugetServer = "http://10.0.60.89:8080"; var nugetServer = NugetServerHelper.Get(); var nugetPks = new DirectoryInfo(resultDic).GetFiles("*.nupkg"); if (nugetPks.Length <= 0) { errorMsg = "nupkg not gen"; return(false); } Utility.RunCmd(Utility.NugetExePath, "push " + nugetPks[0].FullName + " -s " + nugetServer.Address + " " + nugetServer.Key, out error); } return(true); }
private void ShowNugetServerDialog() { var window = new ServiceNugetServer() { Owner = this }; window.Closed += (sender, e) => { var nuget = NugetServerHelper.Get(); if (string.IsNullOrEmpty(nuget?.Address)) { cbPublish.IsChecked = false; } }; window.ShowDialog(); }
/// <summary> ///生成nuget包 /// </summary> /// <param name="filePath"></param> /// <param name="serviceModel"></param> /// <param name="errorMsg"></param> /// <param name="resultDic"></param> /// <returns></returns> public static bool ExcuteNuget(string filePath, ServiceModel serviceModel, string tempKey, out string csNamespace, out string errorMsg, out string resultDic) { csNamespace = string.Empty; errorMsg = string.Empty; resultDic = string.Empty; if (!ExecuteDll(filePath, tempKey, out csNamespace, out errorMsg, out resultDic)) { return(false); } var nuspecXml = GenUtilityOrigin.GenNuspecXml(resultDic, serviceModel, csNamespace); var nuspecFilePath = Path.Combine(resultDic, "Package.nuspec"); Utility.WriteNewFile(nuspecFilePath, nuspecXml); // 生成nuget包msbu var error = string.Empty; Utility.RunCmd(Utility.NugetExePath, "pack " + nuspecFilePath + " -OutputDirectory " + resultDic, out error); // 直接发布 if (serviceModel.Publish) { var nugetServer = NugetServerHelper.Get(); var nugetPks = new DirectoryInfo(resultDic).GetFiles("*.nupkg"); if (nugetPks.Length <= 0) { errorMsg = "nupkg not gen"; return(false); } Utility.RunCmd(Utility.NugetExePath, "push " + nugetPks[0].FullName + " -s " + nugetServer.Address + " " + nugetServer.Key, out error); } return(true); }