Skip to main content
Nintex Community Menu Bar

K2 Five >> Automate Deployment Using SourceCode.Deployment.Management Issue

  • October 28, 2018
  • 2 replies
  • 2 views
  • Translate

Forum|alt.badge.img+1

In order to automate the package and deployment process I used SourceCode.Deployment.Management dll to create the deployment package using the following code: 

Session session = _packageDeploymentManager.CreateSession("K2Module" + DateTime.Now.ToString());                session.SetOption("NoAnalyze", true);                PackageItemOptions options = PackageItemOptions.Create();                options.ValidatePackage = Validate;                var pathNamespace = "/root/";                var rootNamespace = "urn:SourceCode/Categories";                string ns;                string category;                var categories = Category.Split('');                if (categories.Length > 1)                {                    var parentCats = string.Join("/", categories.Take(categories.Length - 1));                    pathNamespace += parentCats + "/";                }                category = categories.Last();                ns = rootNamespace + "?" + Uri.EscapeDataString(category) + "#Path." + Uri.EscapeDataString(pathNamespace);                                var typeRef = new TypeRef(category, ns);                                var query = QueryItemOptions.Create(typeRef);                var results = session.FindItems(query).Result;                foreach (var result in results)                {                    options.Include(result, PackageItemMode.IncludeDependencies);                }                options.PackageItemMode = IncludeDependenciesAsReference ? PackageItemMode.IncludeDependenciesAsReference : PackageItemMode.IncludeDependencies;                session.PackageItems(options);                var fileStream = new FileStream(Path, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read);                session.Model.Save(fileStream);                fileStream.Close();                _packageDeploymentManager.CloseSession(session.Name);

but I couldn't deploy the genrated package, becuase of error "This version was created on version is no longer suppoerded on this target environment", Actually I'm using K2 five and all dlls I'm using from inside the environment itself.   

Did this topic help you find an answer to your question?

2 replies

Forum|alt.badge.img+1
  • Author
  • 3 replies
  • October 29, 2018

Hi Sello,

 

Thanks for your reply, but actually I'm working on K2 five version 5.2 and this solution doesn't work with me.

 

Thanks, 

Translate

Forum|alt.badge.img+15

The environment your package was created on must match the environment the package is being deployed to. Most importantly, they must be on the same version, with the same updates applied.


 


First off, make sure both environment is on the same version.


 


Secondly, check the HostServer.UpdateHistory table on your K2 database. Make sure both environments have the same updates applied.


 


Once you have the above nailed down, you can use the dll from either the source or target environment. It shouldn't matter at this point.


 

Translate

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings