@@ -322,6 +322,7 @@ RpcArgs::SuccessResult RpcHandler::LoadPacks(void) {
322322RpcArgs::SuccessResult RpcHandler::LoadSolution (const string& solution, const string& activeTarget) {
323323 m_bUseAllPacks = false ; // loading solution will first use only listed packs
324324 m_packReferences.clear (); // will be updated
325+ m_manager.Clear ();
325326 m_solutionLoaded = false ; // assume not loaded yet
326327 auto globalModel = ProjMgrKernel::Get ()->GetGlobalModel ();
327328 // remove non-existing and explicit packs
@@ -338,6 +339,13 @@ RpcArgs::SuccessResult RpcHandler::LoadSolution(const string& solution, const st
338339 result.message = solution + " is not a *.csolution.yml file" ;
339340 return result;
340341 }
342+ if (purged) {
343+ // we need to add available packs to model again (the packs are already loaded)
344+ m_worker.InitializeModel ();
345+ m_worker.SetLoadPacksPolicy (LoadPacksPolicy::ALL );
346+ result.success = m_worker.LoadAllRelevantPacks ();
347+ m_worker.SetLoadPacksPolicy (LoadPacksPolicy::DEFAULT );
348+ }
341349 // we disregard return value of m_manager.LoadSolution() here, because we tolerate some errors
342350 m_manager.LoadSolution (csolutionFile, activeTarget);
343351 map<string, ContextItem>* contexts = nullptr ;
@@ -880,6 +888,7 @@ RpcArgs::ConvertSolutionResult RpcHandler::ConvertSolution(const string& solutio
880888 m_bUseAllPacks = false ; // loading solution will first use only listed packs
881889 m_packReferences.clear (); // will be updated
882890 m_solutionLoaded = false ; // assume not loaded
891+ m_manager.Clear ();
883892 auto globalModel = ProjMgrKernel::Get ()->GetGlobalModel ();
884893 // remove non-existing and explicit packs
885894 // clear model and projects if at least one pack is deleted
0 commit comments