在 .pubxml 中添加自定义 dbDacFx 提供程序参数
Add custom dbDacFx Provider Parameters in .pubxml
我有 Visual Studio 解决方案,包括 Web
和 SSDT
项目。我想使用 WebDeployPackage 部署我的网站。我明确想告诉 dbDacFx 不要通过已知参数 ScriptDatabaseOptions=False
部署数据库属性,但我不知道如何在 pubxml 文件中参数化 dbDacFx Provider。生成的部署配置文件如下所示:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>Package</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<DesktopBuildPackageLocation>E:\Users\...</DesktopBuildPackageLocation>
<PackageAsSingleFile>true</PackageAsSingleFile>
<DeployIisAppPath>mySite/launchSite</DeployIisAppPath>
<PublishDatabaseSettings>
<Objects xmlns="">
<ObjectGroup Name="xxx" Order="1" Enabled="True">
<Destination Path="ConnectionString" Name="ConnectionStringName" />
<Object Type="DbDacFx">
<PreSource Path="ConnectionString" includeData="False" />
<Source Path="$(IntermediateOutputPath)AutoScripts\xxx_IncrementalSchemaOnly.dacpac" dacpacAction="Deploy" />
</Object>
<UpdateFrom Type="Web.Config">
<Source MatchValue="EntityConnectionString" MatchAttributes="$(UpdateFromConnectionStringAttributes)" />
</UpdateFrom>
</ObjectGroup>
</Objects>
</PublishDatabaseSettings>
</PropertyGroup>
...
</Project>
我正在使用 Visual Studio 2015 Enterprise。
找到答案了。我将参数添加到 dacpac 源节点,如下所示:
<Source Path="$(IntermediateOutputPath)AutoScripts\xxx_IncrementalSchemaOnly.dacpac" dacpacAction="Deploy" ScriptDatabaseOptions="False" />
您可以在此处找到完整的选项列表:SqlPackage
我有 Visual Studio 解决方案,包括 Web
和 SSDT
项目。我想使用 WebDeployPackage 部署我的网站。我明确想告诉 dbDacFx 不要通过已知参数 ScriptDatabaseOptions=False
部署数据库属性,但我不知道如何在 pubxml 文件中参数化 dbDacFx Provider。生成的部署配置文件如下所示:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>Package</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<DesktopBuildPackageLocation>E:\Users\...</DesktopBuildPackageLocation>
<PackageAsSingleFile>true</PackageAsSingleFile>
<DeployIisAppPath>mySite/launchSite</DeployIisAppPath>
<PublishDatabaseSettings>
<Objects xmlns="">
<ObjectGroup Name="xxx" Order="1" Enabled="True">
<Destination Path="ConnectionString" Name="ConnectionStringName" />
<Object Type="DbDacFx">
<PreSource Path="ConnectionString" includeData="False" />
<Source Path="$(IntermediateOutputPath)AutoScripts\xxx_IncrementalSchemaOnly.dacpac" dacpacAction="Deploy" />
</Object>
<UpdateFrom Type="Web.Config">
<Source MatchValue="EntityConnectionString" MatchAttributes="$(UpdateFromConnectionStringAttributes)" />
</UpdateFrom>
</ObjectGroup>
</Objects>
</PublishDatabaseSettings>
</PropertyGroup>
...
</Project>
我正在使用 Visual Studio 2015 Enterprise。
找到答案了。我将参数添加到 dacpac 源节点,如下所示:
<Source Path="$(IntermediateOutputPath)AutoScripts\xxx_IncrementalSchemaOnly.dacpac" dacpacAction="Deploy" ScriptDatabaseOptions="False" />
您可以在此处找到完整的选项列表:SqlPackage