问题描述
更新:我已经用一个新的空VS2015 WebApplication项目重现了相同的错误.
Update:I have reproduced the same Error with a new empty VS2015 WebApplication project.
- 将connectionString添加到新的空SQL数据库
- 在解决方案中添加了一个sql脚本文件,并在发布向导中选择了发布...".
构建Web部署程序包或Web部署时,我会收到相同的错误.
I will get the same error building a web deployment package or web deploy .
原始帖子:"SqlScriptPreprocessSqlVariables"任务意外失败.当我将发布向导或MSBuild与选择了更新数据库的配置文件一起使用时,会发生这种情况.在仅安装VS2015 Update1的新安装的计算机上,以及在带有Team Fondation Server 2015 Build Agent的构建服务器上.相同的发布配置文件可在我们的VS2013环境中使用.
Original post:The "SqlScriptPreprocessSqlVariables" task failed unexpectedly. This happens when I use publishing wizard or MSBuild with a profile where the Update Database is selected. On a newly installed machine with only VS2015 Update1 and also on our build server with Team Fondation Server 2015 Build Agent. The same publish profile works in our VS2013 environment.
System.TypeLoadException: Signature of the body and declaration in a method implementation do not match.
Type: 'Microsoft.Web.Publishing.Tasks.SqlScriptPreprocessor.SqlCommandExecuter'.
Assembly: 'Microsoft.Web.Publishing.Tasks, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
at Microsoft.Web.Publishing.Tasks.SqlScriptPreprocessor.SqlScriptPreprocessSqlVariables.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask>d__26.MoveNext()
这里是相同的错误,但来自新构建系统中的Build Agent.我在新的Agent上遇到了相同的错误runnig XAML.
Here is the same error but from the Build Agent in the new build system. I got the same error runnig XAML build on the new Agent.
##[error]C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Deploy\Microsoft.Web.Publishing.MSDeploy.Common.targets(119,5): Error MSB4018: The "SqlScriptPreprocessSqlVariables" task failed unexpectedly.
##[error]System.TypeLoadException: Signature of the body and declaration in a method implementation do not match. Type: 'Microsoft.Web.Publishing.Tasks.SqlScriptPreprocessor.SqlCommandExecuter'. Assembly: 'Microsoft.Web.Publishing.Tasks, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
##[error] at Microsoft.Web.Publishing.Tasks.SqlScriptPreprocessor.SqlScriptPreprocessSqlVariables.Execute()
##[error] at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
##[error] at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
推荐答案
这是解决webdeploy打包问题的方法.我建议不要使用此解决方案,但它可以在我的机器和构建服务器上使用.
This is how I fixed the webdeploy packaging problem. This is not a solution I recommend but it works on my machine and on the build server.
找到文件 Microsoft.Web.Publishing.MsDeploy.Common.targets
这是我机器上的位置:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Deploy\ Microsoft.Web.Publishing.MsDeploy.Common.targets
在第117行并向前,我注释了以下部分.
On row 117 and forward I commented out the following section.
<!--<SqlScriptPreprocessSqlVariables
UnsupportedKeywords="$(MsdeploySqlUnsupportedCommand)" CheckForUnsupportCommands="$(CheckSqlScriptForUnsupportedCommands)"
TreadSqlScriptUnsupportedCommandsAsWarning="$(TreadSqlScriptUnsupportedCommandsAsWarning)"
SqlScriptFile="%(_DatabasesToPackageForSQL.SourcePath)"
DestinationGroup="%(_DatabasesToPackageForSQL.DestinationGroup)"
ResolveIncludes="$(SqlScriptPreProcessResolveIncludes)"
BatchDelimiter="$(SqlScriptPreProcessBatchDelimiter)"
Condition="$(EnableSqlScriptVariableParameterize) And '%_DatabasesToPackageForSQL.SourcePath)' != '' And Exists('%(_DatabasesToPackageForSQL.SourcePath)') ">
<Output TaskParameter="List" ItemName="_DatabasesToPackage_SqlVariables" />
</SqlScriptPreprocessSqlVariables>-->
这篇关于使用更新数据库运行Web发布向导时出现Visual Studio 2015异常SqlScriptPreprocessSqlVariables的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!