bcptoolkit:code_reference:net_library:bcpservicebuilder

BcpServiceBuilder Class

A factory that creates the BcpService with the relevant settings.

Namespace: bcpDevKit
Assembly: bcpDevKit.dll

System.Object
bcpDevKit.IBcpServiceBuilder
bcpDevKit.BcpServiceBuilder

public class BcpServiceBuilder : IBcpServiceBuilder

TypeNameDescription
BcpVersionVersionGets or sets the vault version for which you want to create a BCP package. The default version is BcpVersion._2020.
DirectoryInfoPackageDirectoryGets or sets the output folder where it will create the BCP package.
TypeNameDescription
voidSetPackageLocation(string packageLocation)Assigns the specified path to the PackageDirectory.
IBcpServiceBuild()Creates a new BcpService with the relevant settings.

The PackageDirectory is set by default to the TEMP directory on your computer. More details on its determination can be found here.
SetPackageLocation throws an exception of type DirectoryNotFoundException when an invalid path is passed to the function.

Create a new BCP package and add files

using bcpDevKit;
using bcpDevKit.Entities;

class Program
{
    static void Main(string[] args)
    {
        var bcpSvcBuilder = new BcpServiceBuilder {Version = BcpVersion._2020};
        bcpSvcBuilder.SetPackageLocation(@"C:\Temp\Package1");
        var bcpSvc = bcpSvcBuilder.Build();
             
        var catchAssembly = bcpSvc.FileService.AddFile("$/Designs/Catch Assembly.iam", @"C:\Catch Assembly.iam");
        bcpSvc.Flush();
    }
}