共用方式為


Project.MarkDirty Method

Definition

Called to forcibly mark the project as dirty requiring reevaluation. Generally this is not necessary to set; all edits affecting this project will automatically make it dirty. However there are potential corner cases where it is necessary to mark the project dirty directly. For example, if the project has an import conditioned on a file existing on disk, and the file did not exist at evaluation time, then someone subsequently creates that file, the project cannot know that reevaluation would be productive. In such a case the host can help us by setting the dirty flag explicitly so that ReevaluateIfNecessary() will recognize an evaluation is indeed necessary. Does not mark the underlying project file as requiring saving.

public:
 void MarkDirty();
public void MarkDirty ();
member this.MarkDirty : unit -> unit
Public Sub MarkDirty ()

Remarks

It is seldom necessary to call this method explicitly, because all edits affecting a project automatically mark it as modified.

Sometimes, however, this method must be called. For example, a project may have an Import element whose condition depends on a file that exists on a disk. If that file does not exist at evaluation time, and it is created after evaluation, then the project must be explicitly marked as modified.

The ReevaluateIfNecessary method uses this property to determine if an evaluation is necessary.

Applies to