5

When deploying a dacpac for the first time using SqlPackage.exe how do I control the logical and physical file names for the new database.

The standard SQL statement would be:

CREATE DATABASE Bar
ON PRIMARY (NAME = 'Foo', FILENAME = '...\Foo\Foo.mdf')
LOG ON (NAME = 'Foo_log', FILENAME = '...\Foo\Foo.ldf')
Chris Chilvers
  • 6,429
  • 3
  • 32
  • 53

1 Answers1

2

It seems this is not possible out of the box with the current tools. The variables $(DefaultFilePath) and $(DefaultLogPath) control the location but cannot be changed from the command line.

These values can be changed by using a custom deployment contributor, see Overriding DefaultDataPath and DefaultLogPath variables when using SqlPackage to publishing a dacpac.

Community
  • 1
  • 1
Chris Chilvers
  • 6,429
  • 3
  • 32
  • 53