DacAliases.

PublishDacpacFile(ICakeContext, string, string, FilePath, PublishDacpacSettings) Method

Summary

Publish a dacpac file to a database.
Assembly
Cake.SqlServer.dll
Namespace
Cake.SqlServer
Containing Type
DacAliases

Syntax

public static void PublishDacpacFile(this ICakeContext context, string connectionString, string targetDatabaseName, FilePath dacpacFilePath, PublishDacpacSettings settings = null)

Examples

    #addin "nuget:?package=Cake.SqlServer"

    Task("Create-Bacpac")
    	.Does(() =>{
    		var connString = @"data source=(localdb)\MSSqlLocalDb";
    
    		var dbName = "ForDacpac";
    
    		var file = new FilePath(@".\src\Tests\TestData\Nsaga.dacpac");
    
    		var settings = new PublishDacpacSettings { 
    			GenerateDeploymentScript = true
			};

    		PublishDacpacFile(connString, dbName, file, settings);
    	});
    });        

Attributes

Type Description
CakeMethodAliasAttribute

Parameters

Name Type Description
context ICakeContext The Cake context.
connectionString string The connection string. You may want to connect to master database for this operation.
targetDatabaseName string Name of a target database.
dacpacFilePath FilePath Full path to the dacpac file.
settings PublishDacpacSettings Configure the sql deployment

Return Value

Type Description
void