UnregisterAssembly Task
 

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

For the latest documentation on Visual Studio 2017, see UnregisterAssembly Task on docs.microsoft.com. Unregisters the specified assemblies for COM interop purposes. Performs the reverse of the RegisterAssembly task.

The following table describes the parameters of the UnregisterAssembly task.

ParameterDescription
AssembliesOptional ITaskItem[] parameter.

Specifies the assemblies to be unregistered.
AssemblyListFileOptional ITaskItem parameter.

Contains information about the state between the RegisterAssembly task and the UnregisterAssembly task. This prevents the task from attempting to unregister an assembly that failed to register in the RegisterAssembly task.

If this parameter is specified, the Assemblies and TypeLibFiles parameters are ignored.
TypeLibFilesOptional ITaskItem[] output parameter.

Unregisters the specified type library from the specified assembly. Note: This parameter is only necessary if the type library file name is different than the assembly name.

It is not required that the assembly exists for this task to be successful. If you attempt to unregister an assembly that does not exist, the task will succeed with a warning. This occurs because it is the job of this task to remove the assembly registration from the registry. If the assembly does not exist, it is not in the registry, and therefore, the task succeeded.

In addition to the parameters listed above, this task inherits parameters from the AppDomainIsolatedTaskExtension class, which itself inherits from the MarshalByRefObject class. The MarshalByRefObject class provides the same functionality as the Task class, but it can be instantiated in its own application domain.

The following example uses the UnregisterAssembly task to unregister the assembly at the path specified by the OutputPath and FileName properties, if it exists.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  
    <PropertyGroup>  
        <OutputPath>\Output\</OutputPath>  
        <FileName>MyFile.dll</FileName>  
    </PropertyGroup>  
    <Target Name="UnregisterAssemblies">  
        <UnregisterAssembly  
            Condition="Exists('$(OutputPath)$(FileName)')"  
            Assemblies="$(OutputPath)$(FileName)" />  
    </Target>  
  
</Project>  

RegisterAssembly Task
Tasks
Task Reference