SQL Change Automation 4

Export-DatabaseBuildArtifact

Exports an IBuildArtifact object to disk.

Syntax

Export-DatabaseBuildArtifact [-InputObject] <IBuildArtifact> -Path <Object> [-Force] [-OutputFormat <BuildArtifactOutputFormat>] [<CommonParameters>]

Description

The Export-DatabaseBuildArtifact cmdlet exports the IBuildArtifact object produced by the New-DatabaseBuildArtifact cmdlet as a NuGet package or as a .zip file.

Parameters

-InputObject <RedGate.Versioning.Automation.Compare.Domain.BuildArtifacts.IBuildArtifact>

The IBuildArtifact object to be exported.

Aliases None
Required? true
Position? 0
Default Value None
Accept Pipeline Input true (ByValue)
Accept Wildcard Characters false

-Path <System.Object>

The path to the folder the build artifact is exported to. If the folder doesn't already exist, it will be created when the build artifact is exported.

Aliases None
Required? true
Position? named
Default Value None
Accept Pipeline Input false
Accept Wildcard Characters false

-Force <System.Management.Automation.SwitchParameter>

Use this parameter to overwrite any existing build artifact with the same name.

Aliases None
Required? false
Position? named
Default Value False
Accept Pipeline Input false
Accept Wildcard Characters false

-OutputFormat <RedGate.Versioning.Automation.Compare.BuildArtifacts.BuildArtifactOutputFormat>

The output format of the Build Artifact. If you don't use this parameter the default behaviour is to export to a NuGet package

Possible values: NuGet, Zip

Aliases None
Required? false
Position? named
Default Value NuGet
Accept Pipeline Input false
Accept Wildcard Characters false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see http://technet.microsoft.com/en-us/library/hh847884.aspx.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • RedGate.Versioning.Automation.Compare.Domain.BuildArtifacts.IBuildArtifact

    The IBuildArtifact object to be exported.

Return values

The output type is the type of the objects that the cmdlet emits.

  • None

Examples

---------- EXAMPLE 1 ----------

$project = "C:\Work\project\project.sqlproj"
$validatedProject = $project | Invoke-DatabaseBuild
$buildArtifact = $validatedProject | New-DatabaseBuildArtifact -PackageId MyDatabase -PackageVersion 1.0.0
$buildArtifact | Export-DatabaseBuildArtifact -Path "C:\Export\buildArtifacts"

In this example, the New-DatabaseBuildArtifact cmdlet creates an IBuildArtifact object from a validated database schema. The Export-DatabaseBuildArtifact cmdlet then exports the build artifact to C:\Export\buildArtifacts as a NuGet package.

---------- EXAMPLE 2 ----------

$project = "C:\Work\project\project.sqlproj"
$validatedProject = $project | Invoke-DatabaseBuild
$buildArtifact = $validatedProject | New-DatabaseBuildArtifact -PackageId MyDatabase -PackageVersion 1.0.0
$buildArtifact | Export-DatabaseBuildArtifact -Path "C:\Export\buildArtifacts" -OutputFormat Zip

In this example, the New-DatabaseBuildArtifact cmdlet creates an IBuildArtifact object from a validated database schema. The Export-DatabaseBuildArtifact cmdlet then exports the build artifact to C:\Export\buildArtifacts as a zip file.

---------- EXAMPLE 3 ----------

$scriptsFolder = "C:\Work\scripts"
$validatedProject = $scriptsFolder | Invoke-DatabaseBuild
$buildArtifact = $validatedProject | New-DatabaseBuildArtifact -PackageId MyDatabase -PackageVersion 1.0.0
$buildArtifact | Export-DatabaseBuildArtifact -Path "C:\Export\buildArtifacts"

In this example, the New-DatabaseBuildArtifact cmdlet creates an IBuildArtifact object from a validated database schema. The Export-DatabaseBuildArtifact cmdlet then exports the package to c:\Export\buildArtifacts as a NuGet package.


Didn't find what you were looking for?