Visual Studio 2013: Database Project MSBuild error

2019-01-22 05:24发布

I've got a database project as part of my solution in Visual Studio 2013. Been working perfectly for the last 3 weeks and now suddenly today it won't build and so I cannot publish any changes. I'm getting an MSBuild error:

"C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(513,5): Error: MSB4018: The "SqlBuildTask" task failed unexpectedly. System.MethodAccessException: Attempt by method 'Microsoft.Data.Tools.Schema.Sql.Build.SqlTaskHost.OnCreateCustomSchemaData(System.String, System.Collections.Generic.Dictionary`2)' to access method 'Microsoft.Data.Tools.Components.Diagnostics.SqlTracer.ShouldTrace(System.Diagnostics.TraceEventType)' failed."

Anyone got any ideas? All I did this morning was pull down the latest changes from source control. I can't see how that would mess up the actual MSBuild process, and the guy who checked in last doesn't have any issues at all.

13条回答
beautiful°
2楼-- · 2019-01-22 05:37

I had the same issue. Running disk check and then rebooting fixed it.

查看更多
来,给爷笑一个
3楼-- · 2019-01-22 05:39

You need to install the last version of SQL Server Data Tools:

http://msdn.microsoft.com/en-US/data/hh297027

Make sure to restart VS and then build the solution again. This solves the problem!

查看更多
Evening l夕情丶
4楼-- · 2019-01-22 05:39

I got the same error and fix it by re-install Visual Studio 2015

查看更多
爷、活的狠高调
5楼-- · 2019-01-22 05:40

I searched "Visual Studio 2013 Update 2" in MSDN subscriber downloads and it was there

Also I filed a bug with MS VS2013 SqlBuildTask 04018 Error Please up vote it if you are getting the same problem

查看更多
ゆ 、 Hurt°
6楼-- · 2019-01-22 05:50

I already had the newest Version of SQL Data Tools installed, but after installing VS2015 RC it stopped to work. After run a repair on SSDT it compiles again with success.

查看更多
Rolldiameter
7楼-- · 2019-01-22 05:56

I had the same issue. I tried to repair Visual Studio 2013, update 4, SSDT, the DAC tools, etc., but it didn't work any better.

However I noticed the Microsoft.Data.Tools.Schema.SqlTasks.targets file present in C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\SSDT was dated from 2013 (In fact it corresponded to the old SSDT). So what I did is just copy the new one (which I suprisingly found in C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT ...) over to this v12.0\SSDT folder, restarted Visual Studio 2013 and now it works. For information, that new SSDT targets file is dated from 2014/10/26 and its size is 75437 bytes.

查看更多
登录 后发表回答