Loading a project file through code

The code sample below demonstrates a method of loading a K2 project file using code.

This code sample requires a class reference to the assemblies:


and project references to

//set the path to the K2 project file to load
string filename = "[K2ProjectFilePath.kprx]";
SourceCode.ProjectSystem.Project project = new Project();
project.Load(filename);
//load the .kprx files in the project recursively and iterate over them
foreach(SourceCode.ProjectSystem.ProjectFile file in project.GetAllFiles("kprx", true)) {
 //do something, e.g. read the file path of each .kprx file
 string filePath = file.FullFileName;
}

K2 blackpearl Developers Reference4.7
Video Links Learn Support
No videos found for this article
K2 on YouTube
No Additional links found for this article
No self-learning content for this article
Try some scenarios...
No relevant support links available for this article