public static void AddOrUpdateSpklMapping(Project project, string profile, SolutionPackageConfig solutionPackageConfig) { var spklConfig = CoreMapping.GetSpklConfigFile(project); if (profile.StartsWith(ExtensionConstants.NoProfilesText)) { spklConfig.solutions[0] = solutionPackageConfig; } else { var existingSolutionPackageConfig = spklConfig.solutions.FirstOrDefault(s => s.profile == profile); if (existingSolutionPackageConfig != null && solutionPackageConfig != null) { existingSolutionPackageConfig.increment_on_import = solutionPackageConfig.increment_on_import; existingSolutionPackageConfig.map = solutionPackageConfig.map; existingSolutionPackageConfig.packagetype = solutionPackageConfig.packagetype; existingSolutionPackageConfig.packagepath = solutionPackageConfig.packagepath.Replace("/", string.Empty); existingSolutionPackageConfig.solution_uniquename = solutionPackageConfig.solution_uniquename; existingSolutionPackageConfig.solutionpath = FormatSolutionName(solutionPackageConfig.solutionpath); } } var projectPath = D365DeveloperExtensions.Core.Vs.ProjectWorker.GetProjectPath(project); ConfigFile.UpdateSpklConfigFile(projectPath, spklConfig); }
public static SolutionPackageConfig GetSolutionPackageConfig(Project project, string profile) { var spklConfig = CoreMapping.GetSpklConfigFile(project); var spklSolutionPackageConfigs = spklConfig.solutions; if (spklSolutionPackageConfigs == null) { return(null); } var solutionPackageConfig = profile.StartsWith(ExtensionConstants.NoProfilesText) ? spklSolutionPackageConfigs[0] : spklSolutionPackageConfigs.FirstOrDefault(p => p.profile == profile); return(solutionPackageConfig); }
public static SolutionPackageConfig GetSolutionPackageConfig(Project project, string profile, ObservableCollection <CrmSolution> crmSolutions) { SpklConfig spklConfig = CoreMapping.GetSpklConfigFile(project); List <SolutionPackageConfig> spklSolutionPackageConfigs = spklConfig.solutions; if (spklSolutionPackageConfigs == null) { return(null); } SolutionPackageConfig solutionPackageConfig = profile.StartsWith(ExtensionConstants.NoProfilesText) ? spklSolutionPackageConfigs[0] : spklSolutionPackageConfigs.FirstOrDefault(p => p.profile == profile); return(solutionPackageConfig); }