2012-09-18 98 views
1

使用dbDacFx我試圖創建一個包來部署網站和數據庫。清單文件

的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> 

而且我得到以下錯誤:

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

是否有可能使用dbDacFx供應商在manifes T'

回答

1

它看起來是不可能直接在清單使用dbDacFx供應商,但有一種變通方法,以創建一個使用msdeploy包。

的manifest.xml(應包含的完整路徑):

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

問題命令:

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"