Assembly Class

MSBuild Extension Pack

Assembly Class MSBuild Extension Pack Help 4.0.12.0
Valid TaskActions are:

GetInfo (Required: NetAssembly Output: OutputItems)

GetMethodInfo (Required: NetAssembly, NetClass, Output: OutputItems)

Invoke (Required: NetAssembly Optional: NetMethod, NetArgumentsOutput: ReturnValue)

Remote Execution Support: No

Inheritance Hierarchy

SystemObject  SystemMarshalByRefObject
    Microsoft.Build.UtilitiesAppDomainIsolatedTask
      MSBuild.ExtensionPackBaseAppDomainIsolatedTask
        MSBuild.ExtensionPack.FrameworkAssembly

Namespace: MSBuild.ExtensionPack.Framework
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0

The Assembly type exposes the following members.

Constructors

  NameDescription
Public methodAssembly
Top
Properties

  NameDescription
Public propertyNetArguments
Sets the arguments to use for invoking a method. The arguments must be specified with a type, i.e. int
Public propertyNetAssembly
Sets the name of the Assembly
Public propertyNetClass
Sets the name of the Class
Public propertyNetMethod
Sets the name of the Method. If this is not provided, a call is made to the default constructor.
Public propertyOutputItems
Gets the outputitems.

For a call to GetMethodInfo, OutputItems provides the following metadata: Parameters

For a call to GetInfo, OutputItems provides the following metadata: AssemblyVersion, FileVersion, Culture, CultureDisplayName, FullName, PublicKeyToken, AssemblyInformationalVersion

Public propertyResult
Gets any Result that is returned
Top
Examples

<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath>
        <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
    </PropertyGroup>
    <Import Project="$(TPath)"/>
    <Target Name="Default">
        <ItemGroup>
            <!-- define a set of arguments to use against an assembly -->
            <Args Include="1">
                <Type>int</Type>
            </Args>
            <Args Include="2">
                <Type>int</Type>
            </Args>
            <ArgsM Include="2.9845">
                <Type>decimal</Type>
            </ArgsM>
            <ArgsM Include="1.9845">
                <Type>decimal</Type>
            </ArgsM>
            <ArgsF Include="C:\Demo1 - Please Delete">
                <Type>string</Type>
            </ArgsF>
        </ItemGroup>
        <!-- Get information on an assembly -->
        <MSBuild.ExtensionPack.Framework.Assembly TaskAction="GetInfo" NetAssembly="C:\Projects\MSBuildExtensionPack\Solutions\Main3.5\BuildBinaries\MSBuild.ExtensionPack.dll">
            <Output TaskParameter="OutputItems" ItemName="Info"/>
        </MSBuild.ExtensionPack.Framework.Assembly>
        <Message Text="Identity: %(Info.Identity)" />
        <Message Text="FullName: %(Info.FullName)" />
        <Message Text="PublicKeyToken: %(Info.PublicKeyToken)" />
        <Message Text="Culture: %(Info.Culture)" />
        <Message Text="CultureDisplayName: %(Info.CultureDisplayName)" />
        <Message Text="FileVersion: %(Info.FileVersion)" />
        <Message Text="AssemblyVersion: %(Info.AssemblyVersion)" />
        <Message Text="AssemblyInformationalVersion: %(Info.AssemblyInformationalVersion)" />
        <!-- This will cause a default constructor call only -->
        <MSBuild.ExtensionPack.Framework.Assembly TaskAction="Invoke" NetClass="AssemblyDemo" NetAssembly="C:\Projects\MSBuildExtensionPack\Solutions\Main3.5\SampleScratchpad\SampleBuildBinaries\AssemblyDemo.dll"/>
        <!--Invoke the assembly with the args collection of arguments -->
        <MSBuild.ExtensionPack.Framework.Assembly TaskAction="Invoke" NetArguments="@(Args)" NetClass="AssemblyDemo" NetMethod="AddNumbers" NetAssembly="C:\Projects\MSBuildExtensionPack\Solutions\Main3.5\SampleScratchpad\SampleBuildBinaries\AssemblyDemo.dll">
            <Output TaskParameter="Result" PropertyName="R"/>
        </MSBuild.ExtensionPack.Framework.Assembly>
        <Message Text="Result: $(R)"/>
        <MSBuild.ExtensionPack.Framework.Assembly TaskAction="Invoke" NetArguments="@(ArgsM)" NetClass="AssemblyDemo" NetMethod="MultiplyNumbers" NetAssembly="C:\Projects\MSBuildExtensionPack\Solutions\Main3.5\SampleScratchpad\SampleBuildBinaries\AssemblyDemo.dll">
            <Output TaskParameter="Result" PropertyName="R"/>
        </MSBuild.ExtensionPack.Framework.Assembly>
        <Message Text="Result: $(R)"/>
        <MSBuild.ExtensionPack.Framework.Assembly TaskAction="Invoke" NetArguments="@(ArgsF)" NetClass="AssemblyDemo" NetMethod="CreateFolder" NetAssembly="C:\Projects\MSBuildExtensionPack\Solutions\Main3.5\SampleScratchpad\SampleBuildBinaries\AssemblyDemo.dll"/>
        <MSBuild.ExtensionPack.Framework.Assembly TaskAction="Invoke" NetClass="AssemblyDemo" NetMethod="CreateDefaultFolder" NetAssembly="C:\Projects\MSBuildExtensionPack\Solutions\Main3.5\SampleScratchpad\SampleBuildBinaries\AssemblyDemo.dll"/>
        <!-- Extract some information on the assembly interface -->
        <MSBuild.ExtensionPack.Framework.Assembly TaskAction="GetMethodInfo" NetAssembly="C:\Projects\MSBuildExtensionPack\Solutions\Main3.5\SampleScratchpad\SampleBuildBinaries\AssemblyDemo.dll">
            <Output TaskParameter="OutputItems" ItemName="TypeInfo"/>
        </MSBuild.ExtensionPack.Framework.Assembly>
        <Message Text="%(TypeInfo.Identity) %(TypeInfo.Parameters)" />
    </Target>
</Project>
See Also

Reference