我正在尝试使用 msbuild.exe 构建一个数据库项目,该项目在装有 64 位操作系统的 Windows Server 2008 R2 Enterprise 的虚拟机上运行。我的大多数应用程序都已成功构建,但这个数据库项目却给我带来了问题。 .NET Framework 2 和 4 已安装。
error MSB4062: The "SqlBuildTask" task could not be loaded from the assembly Microsoft.Data.Schema.Tasks.Sql, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Could not load file or assembly 'Microsoft.Data.Schema.Tasks.Sql, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
我已经在此网站上查看了可能的解决方案:Getting MSBuild and CruiseControl .NET to build and deploy VS2010 database projects
但是我的构建机器上确实安装了 VS2010,但我仍然收到此错误
我已经做过的事情:
- 检查数据库项目的解决方案是否在 VS2010 中成功构建
- 使用 msbuild MyDBtest.dbproj 运行 msbuild 命令 - 这给了我同样的错误。
为了让它发挥作用,我还可能缺少什么?
最佳答案
事实证明,我为 dbproj 执行了错误版本的 MSbuild,我需要使用 C:\Windows\Microsoft.NET\Framework64\v4.0.30319 中的版本,而不是 C:\Windows\Microsoft.NET\Framework64\v2.0.50727。早期版本不支持 .dbproj 类型。
关于msbuild - 错误 "SQLBuildTask"无法从程序集 'Microsoft.Data.Schema.Tasks.Sql' 加载任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11761565/