Condividi tramite


ProjectRootElement.ReloadFrom Method

Definition

Overloads

ReloadFrom(String, Boolean, Nullable<Boolean>)

Reload the existing project root element from the given path An InvalidOperationException is thrown if the path does not exist.

See ReloadFrom(XmlReader, Boolean, Nullable<Boolean>)

ReloadFrom(XmlReader, Boolean, Nullable<Boolean>)

Reload the existing project root element from the given reader A reload operation completely replaces the state of this ProjectRootElement object. This operation marks the object as dirty.

If the new state has invalid XML or MSBuild syntax, then this method throws an InvalidProjectFileException. When this happens, the state of this object does not change.

Reloading from an XMLReader will retain the previous root element location (FullPath, DirectoryPath, ProjectFileLocation).

ReloadFrom(String, Boolean, Nullable<Boolean>)

Source:
ProjectRootElement.cs

Reload the existing project root element from the given path An InvalidOperationException is thrown if the path does not exist.

See ReloadFrom(XmlReader, Boolean, Nullable<Boolean>)

public void ReloadFrom (string path, bool throwIfUnsavedChanges = true, bool? preserveFormatting = default);
member this.ReloadFrom : string * bool * Nullable<bool> -> unit
Public Sub ReloadFrom (path As String, Optional throwIfUnsavedChanges As Boolean = true, Optional preserveFormatting As Nullable(Of Boolean) = Nothing)

Parameters

path
String
throwIfUnsavedChanges
Boolean
preserveFormatting
Nullable<Boolean>

Applies to

ReloadFrom(XmlReader, Boolean, Nullable<Boolean>)

Source:
ProjectRootElement.cs

Reload the existing project root element from the given reader A reload operation completely replaces the state of this ProjectRootElement object. This operation marks the object as dirty.

If the new state has invalid XML or MSBuild syntax, then this method throws an InvalidProjectFileException. When this happens, the state of this object does not change.

Reloading from an XMLReader will retain the previous root element location (FullPath, DirectoryPath, ProjectFileLocation).

public void ReloadFrom (System.Xml.XmlReader reader, bool throwIfUnsavedChanges = true, bool? preserveFormatting = default);
member this.ReloadFrom : System.Xml.XmlReader * bool * Nullable<bool> -> unit
Public Sub ReloadFrom (reader As XmlReader, Optional throwIfUnsavedChanges As Boolean = true, Optional preserveFormatting As Nullable(Of Boolean) = Nothing)

Parameters

reader
XmlReader

Reader to read from

throwIfUnsavedChanges
Boolean

If set to false, the reload operation will discard any unsaved changes. Otherwise, an InvalidOperationException is thrown when unsaved changes are present.

preserveFormatting
Nullable<Boolean>

Whether the reload should preserve formatting or not. A null value causes the reload to reuse the existing PreserveFormatting value.

Applies to