public static void OrganizeFileInProject(VCFileWrapper file) { if (file.RelativePath == null) { throw new InvalidOperationException("project root not set"); } VCProjectWrapper project = file.ContainingProject; string filterPath = Path.GetDirectoryName(file.RelativePath); ContainerWrapper newParent; if (String.IsNullOrEmpty(filterPath)) { newParent = project; } else { newParent = project.CreateFilterPath(filterPath); } if (!file.Parent.Equals(newParent)) { file.Move(newParent); } }