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

  • obj
    Type: System.Object

    The object to be held for later disposal.

  • allowEarlyCollection
    Type: System.Boolean

    Flag 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

See Also

Reference

IBuildEngine4 Interface

Microsoft.Build.Framework Namespace