Monday, June 15, 2015

The "SqlBuildTask" task failed unexpectedly. System.IO.FileNotFoundException

Hey Guys,

While you were building a solution with a DB project inside MVC app, you may see a build error like below.

Error 10 04018: The "SqlBuildTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SqlServer.TransactSql, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.SqlServer.TransactSql, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
   at Microsoft.Data.Tools.Schema.Sql.Build.SemanticVerification.Verify(SqlSchemaModel model, ErrorManager errorManager, String databaseName, String referencesFilePath)
   at Microsoft.Data.Tools.Schema.Sql.Build.SqlTaskHost.RunExtendedValidation(String databaseName, String referencesFile)
   at Microsoft.Data.Tools.Schema.Tasks.Sql.SqlBuildTask.ExecuteValidateModelStep()
   at Microsoft.Data.Tools.Schema.Tasks.Sql.SqlBuildTask.ExecuteStep(Func`1 step)
   at Microsoft.Data.Tools.Schema.Tasks.Sql.SqlBuildTask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Solution:

Go to the project properties of the error throwing project and uncheck


That's it, your solution should build as normal.

4 comments: