Table of Contents

Class RDCoreProject

Namespace
RDCore.SDK.Workspace
Assembly
RDCore.SDK.Protocol.dll

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

string

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

ProjectBuild

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

Dictionary<string, JsonElement>

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

bool

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

RDCoreModule[]

Name

The project's name: what a project-qualified reference to its members names.

public string Name { get; init; }

Property Value

string

OtherFiles

The project's files that are not modules, by their paths relative to the workspace root.

public RDCoreFile[] OtherFiles { get; init; }

Property Value

RDCoreFile[]

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

Dictionary<string, string>

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

RDCoreReference[]

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

string

Methods

GetFolderFiles(string)

The project's modules and other files in folder or under it.

public IEnumerable<RDCoreFile> GetFolderFiles(string folder)

Parameters

folder string

A folder relative to the workspace root, with / separators.

Returns

IEnumerable<RDCoreFile>

GetWorkspaceFolders(string)

The full paths of the project's modules, other files and folders, under srcRoot.

public HashSet<string> GetWorkspaceFolders(string srcRoot)

Parameters

srcRoot string

The workspace root the project's paths are relative to.

Returns

HashSet<string>

WithDocument(RDCoreFile)

The project with document added to its other files.

public RDCoreProject WithDocument(RDCoreFile document)

Parameters

document RDCoreFile

The file to add.

Returns

RDCoreProject

WithFolder(string)

The project with folder added to its folders.

public RDCoreProject WithFolder(string folder)

Parameters

folder string

The folder to add, relative to the workspace root.

Returns

RDCoreProject

WithModule(RDCoreModule)

The project with module added to its modules.

public RDCoreProject WithModule(RDCoreModule module)

Parameters

module RDCoreModule

The module to add.

Returns

RDCoreProject

WithName(string)

The project under another name.

public RDCoreProject WithName(string name)

Parameters

name string

The project's name.

Returns

RDCoreProject

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

name string

The constant's name.

value string

The source text of its value.

Returns

RDCoreProject

WithReference(RDCoreReference)

The project with reference added last to its references, at the lowest priority.

public RDCoreProject WithReference(RDCoreReference reference)

Parameters

reference RDCoreReference

The reference to add.

Returns

RDCoreProject

WithoutDocument(RDCoreFile)

The project without document.

public RDCoreProject WithoutDocument(RDCoreFile document)

Parameters

document RDCoreFile

The file to remove.

Returns

RDCoreProject

WithoutFolder(string)

The project without folder.

public RDCoreProject WithoutFolder(string folder)

Parameters

folder string

The folder to remove.

Returns

RDCoreProject

WithoutModule(RDCoreModule)

The project without module.

public RDCoreProject WithoutModule(RDCoreModule module)

Parameters

module RDCoreModule

The module to remove.

Returns

RDCoreProject

WithoutPrecompilerConstant(string)

The project without the precompiler constant name, whatever the case of its name.

public RDCoreProject WithoutPrecompilerConstant(string name)

Parameters

name string

The constant's name.

Returns

RDCoreProject

WithoutReference(RDCoreReference)

The project without reference.

public RDCoreProject WithoutReference(RDCoreReference reference)

Parameters

reference RDCoreReference

The reference to remove.

Returns

RDCoreProject