添加预部署脚本时 Visual Studio 无法构建;

问题描述 投票:0回答:1

当我尝试构建时遇到此错误。

verity  Code    Description Project File    Line    Suppression State
Error       04094: "C:\Sources\Repos\Dir\PreDeployment\PreDeployment.sql;C:\Sources\Repos\Dir\PreDeployment\PreDeployment.sql" is an invalid value for the "PredeployItem" parameter of the "SqlScriptDependenciesTask" task. Multiple items cannot be passed into a parameter of type "Microsoft.Build.Framework.ITaskItem".   Dir C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VisualStudio\v16.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets   512 

我添加的只是预部署脚本。

  <SqlScriptDependenciesTask
      PostdeployItem="@(PostDeploy->'%(FullPath)')"
      **PredeployItem="@(PreDeploy->'%(FullPath)')"**
      BuildExtensionConfiguration="@(BuildExtensionConfiguration)"
      DeploymentExtensionConfiguration="@(DeploymentExtensionConfiguration)"
      SqlCmdVariables="@(SqlCmdVariables)">

我在任何地方都找不到解决方案?

我的解决方案设置为 enter image description here

部署后运行良好。所以我添加了一个预部署。好像不是这样

sqlproj

 <ItemGroup>
    <PostDeploy Include="PostDeployment\PostDeployment.sql" />
  </ItemGroup>
  <ItemGroup>
    <PreDeploy Include="PreDeployment\PreDeployment.sql" />
  </ItemGroup>
sql-server visual-studio azure-devops build
1个回答
0
投票

我今天遇到了这个问题,请在下面找到解决方案

  1. 复制现有 SQL 脚本之一并添加到解决方案中
  2. 重命名文件并添加您的内容

这应该可以解决问题。

我还注意到这个错误并不会阻止您运行解决方案。

© www.soinside.com 2019 - 2024. All rights reserved.