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:
- SourceCode.Framework.dll
and project references to
- Microsoft.Build.Framework
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;
}