Class RDCoreProject
The workspace structure and project-level configuration declared by a .rdproj.
public record RDCoreProject : IEquatable<RDCoreProject>
- Inheritance
-
RDCoreProject
- Implements
- Inherited Members
Fields
DefaultName
The name of a project that is given none of its own: VBAProject, as MS-VBA names a new project.
public const string DefaultName = "VBAProject"
Field Value
Remarks
A workspace whose project file names no project is named after its folder, or this when its folder's name is no identifier. The shell's own
project is named this too, which leaves its one module, Program, no project of its own name (RD-VBAL §2.2.3).
Properties
Build
The project's build section: what it builds into, and where its program starts. null for a project file that has none,
which is a program that starts at the Sub Main of the one standard module that declares one.
[JsonPropertyName("build")]
[JsonConverter(typeof(ProjectBuildJsonConverter))]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ProjectBuild? Build { get; init; }
Property Value
Remarks
The section is optional, and written only when the project has one. A platform of the format 1.0 reads it as a member it does not know, and writes it back as it was read (SchemaVersion).
ExtensionData
The members of the project this model does not know, as they were read, which are written back (ExtensionData).
[JsonExtensionData]
public Dictionary<string, JsonElement>? ExtensionData { get; init; }
Property Value
Folders
The project's folders, relative to the workspace root, including those no file is in.
public string[] Folders { get; set; }
Property Value
- string[]
IsImported
Whether the project was imported from a Visual Basic 6 project (SourceProject).
[JsonIgnore]
public bool IsImported { get; }
Property Value
Modules
The project's modules: its source files, by their paths relative to the workspace root (RD-VBAL §2.2.3.3).
public RDCoreModule[] Modules { get; init; }
Property Value
Name
The project's name: what a project-qualified reference to its members names.
public string Name { get; init; }
Property Value
OtherFiles
The project's files that are not modules, by their paths relative to the workspace root.
public RDCoreFile[] OtherFiles { get; init; }
Property Value
PrecompilerConstants
Project-level precompiler constants (#Const), keyed by name. The value is the literal
source text of the constant expression (e.g. "1", "-1", ""debug"").
CLI --define arguments override these.
public Dictionary<string, string> PrecompilerConstants { get; init; }
Property Value
References
The libraries and projects the project references, in their priority order (RD-VBAL §2.2.3.2).
public RDCoreReference[] References { get; init; }
Property Value
Remarks
The standard library (VBA) is none of them: every project has it, in every dialect (RD-VBAL §6.0), and a project file does not
list it. A project file that does - with the path of Office's VBE7.DLL, as a VB6 project's references do - is read without it, and written
without it (IsStandardLibrary).
SourceProject
The Visual Basic 6 project (.vbp) the project was imported from, by its path relative to the folder of the .rdproj: the import writes it,
a second import of the same .vbp keeps it, and nothing else changes it. null for a project that was not imported - a
.vbp next to a .rdproj does not make it one.
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? SourceProject { get; init; }
Property Value
Methods
GetFolderFiles(string)
The project's modules and other files in folder or under it.
public IEnumerable<RDCoreFile> GetFolderFiles(string folder)
Parameters
folderstringA folder relative to the workspace root, with
/separators.
Returns
GetWorkspaceFolders(string)
The full paths of the project's modules, other files and folders, under srcRoot.
public HashSet<string> GetWorkspaceFolders(string srcRoot)
Parameters
srcRootstringThe workspace root the project's paths are relative to.
Returns
WithDocument(RDCoreFile)
The project with document added to its other files.
public RDCoreProject WithDocument(RDCoreFile document)
Parameters
documentRDCoreFileThe file to add.
Returns
WithFolder(string)
The project with folder added to its folders.
public RDCoreProject WithFolder(string folder)
Parameters
folderstringThe folder to add, relative to the workspace root.
Returns
WithModule(RDCoreModule)
The project with module added to its modules.
public RDCoreProject WithModule(RDCoreModule module)
Parameters
moduleRDCoreModuleThe module to add.
Returns
WithName(string)
The project under another name.
public RDCoreProject WithName(string name)
Parameters
namestringThe project's name.
Returns
WithPrecompilerConstant(string, string)
The project with the precompiler constant name set to value, whatever the case of its name.
public RDCoreProject WithPrecompilerConstant(string name, string value)
Parameters
Returns
WithReference(RDCoreReference)
The project with reference added last to its references, at the lowest priority.
public RDCoreProject WithReference(RDCoreReference reference)
Parameters
referenceRDCoreReferenceThe reference to add.
Returns
WithoutDocument(RDCoreFile)
The project without document.
public RDCoreProject WithoutDocument(RDCoreFile document)
Parameters
documentRDCoreFileThe file to remove.
Returns
WithoutFolder(string)
The project without folder.
public RDCoreProject WithoutFolder(string folder)
Parameters
folderstringThe folder to remove.
Returns
WithoutModule(RDCoreModule)
The project without module.
public RDCoreProject WithoutModule(RDCoreModule module)
Parameters
moduleRDCoreModuleThe module to remove.
Returns
WithoutPrecompilerConstant(string)
The project without the precompiler constant name, whatever the case of its name.
public RDCoreProject WithoutPrecompilerConstant(string name)
Parameters
namestringThe constant's name.
Returns
WithoutReference(RDCoreReference)
The project without reference.
public RDCoreProject WithoutReference(RDCoreReference reference)
Parameters
referenceRDCoreReferenceThe reference to remove.