Slava
Slava

Reputation: 51

Using dbDacFx in a manifest file

I'm trying to create a package to deploy website and database.

manifest.xml:

<sitemanifest>
   <iisApp path="webApp" />
   <dbDacFx path="database.dacpac" />
</sitemanifest>

parameters.xml:

<parameters>
  <parameter name="appPath" defaultValue="dev.local" tags="iisapp"> 
    <parameterEntry kind="ProviderPath" scope="iisApp" match="webApp" /> 
  </parameter>
  <parameter name="dbServer" defaultValue="localhost" tags="dbServer,sql" />
  <parameter name="connectionString" defaultValue="Server={dbServer};Initial Catalog=MyDatabase;Integrated Security=True;" tags="hidden,sql,sqlconnectionstring">
    <parameterEntry kind="ProviderPath" scope="dbDacFx" match="database.dacpac" /> 
    <parameterEntry kind="XmlFile" scope="webApp\\Web.config" match="//connectionStrings/add[@name='DB']/@connectionString" />
  </parameter>
</parameters>

And I get the following error:

There is no stream data associated with 'database.dacpac'.

Is it possible to use dbDacFx provider in a manifest?

Upvotes: 1

Views: 363

Answers (1)

Slava
Slava

Reputation: 51

It looks like it is not possible to use dbDacFx provider directly in a manifest, but there is a workaround to create a package using msdeploy.

new manifest.xml (should contain the full path):

<sitemanifest>
  <iisApp path="C:\temp\my-test\webApp" />
  <dbDacFx path="C:\temp\my-test\database.dacpac" />
</sitemanifest>

issue command:

msdeploy.exe ^
-verb:sync ^
-source:manifest=C:\temp\my-test\manifest.xml ^
-dest:package=C:\temp\my-test\package.zip ^
-declareParam:name=appPath,defaultValue="dev.local",tags="iisapp",kind=ProviderPath,scope="iisApp",match="C:\\temp\\my-test\\webApp" ^
-declareParam:name=dbServer,defaultValue="localhost",tags="dbServer,sql" ^
-declareParam:name=connectionString,defaultValue="Server={dbServer};Initial Catalog=MyDatabase;Integrated Security=True;",tags="hidden,sql,sqlconnectionstring" ^
-declareParam:name=connectionString,kind=ProviderPath,scope=dbDacFx,match="C:\\temp\\my-test\\database.dacpac" ^
-declareParam:name=connectionString,kind=XmlFile,scope="webApp\\Web.config",match="//connectionStrings/add[@name='DB']/@connectionString"

Upvotes: 1

Related Questions