IBuildEngine4.RegisterTaskObject Method
Registers an object with the system that will be disposed of at some specified time in the future.
MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Namespace: Microsoft.Build.Framework
Assembly: Microsoft.Build.Framework (in Microsoft.Build.Framework.dll)
Syntax
'Declaration
Sub RegisterTaskObject ( _
key As Object, _
obj As Object, _
lifetime As RegisteredTaskObjectLifetime, _
allowEarlyCollection As Boolean _
)
void RegisterTaskObject(
Object key,
Object obj,
RegisteredTaskObjectLifetime lifetime,
bool allowEarlyCollection
)
void RegisterTaskObject(
Object^ key,
Object^ obj,
RegisteredTaskObjectLifetime lifetime,
bool allowEarlyCollection
)
abstract RegisterTaskObject :
key:Object *
obj:Object *
lifetime:RegisteredTaskObjectLifetime *
allowEarlyCollection:bool -> unit
function RegisterTaskObject(
key : Object,
obj : Object,
lifetime : RegisteredTaskObjectLifetime,
allowEarlyCollection : boolean
)
Parameters
key
Type: System.ObjectThe key used to retrieve the object.
obj
Type: System.ObjectThe object to be held for later disposal.
lifetime
Type: Microsoft.Build.Framework.RegisteredTaskObjectLifetimeThe lifetime of the object.
allowEarlyCollection
Type: System.BooleanFlag that determines whether the object can be disposed earlier than the requested time.
Remarks
This method may be called by tasks which need to maintain state across task invocations, such as data caching tasks. It is strongly recommended that allowEarlyCollection be set to true if the object will retain any significant amount of data.
The thread on which the object is disposed may be arbitrarily, but it will not be disposed while the task is executing, even if allowEarlyCollection is set to true.
If the object implements IDisposable, IDisposable.Dispose will be invoked on the object before discarding it.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.