Explicitly manage .NET assemblies


You want to exclude or add assemblies to the list of streamed assemblies.


To add assemblies, call the Add method on AdditionalDependencies. To exclude assemblies to send, call the Add method on ExcludedDependencies.

using System;
using System.IO;
using AGI.Parallel.Client;
using AGI.Parallel.Infrastructure;

namespace CodeSamples
    class Program
        static void Main(string[] args)
            Task task = new NeedsAdditionalFiles();
            using (IJobScheduler scheduler = new ClusterJobScheduler("localhost"))
                Job job = scheduler.CreateJob();

                // Add the assembly by specifying the fullpath of the assembly using AddDependency.

                // Exclude the assembly by specifing it's .NET FullName.
                job.ExcludedDependencies.AddFromAssemblyName("MyAssemblyThatIWantToExclude, Version=, Culture=neutral, PublicKeyToken=null");


        internal class NeedsAdditionalFiles : Task
            public override void Execute()
                // Often times, the use case for the tasks to do this is because of late binding.
                Type t = Type.GetType("AnotherLibrary.MyClass");
                Object obj = Activator.CreateInstance(t);

Internally, the assemblies needed to run a task are automatically detected and the assemblies needed to run a .NET task are automatically streamed. At times, additional control over this automatic behavior may be needed. For instance, client applications may not have a dependency on some required assemblies if they are using dependency injection or reflection to get types, so it will be necessary to send the assemblies manually.

See Also

STK Scalability 1.4 API for .NET