Visual Studio 2013: Database Project MSBuild error
Asked Answered
S

16

74

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.

Sublunary answered 26/8, 2014 at 12:30 Comment(5)
Make sure you and the other developer have the same version of SQL Server Data Tools installed, or just try installing the latest version.Geoff
I've reinstalled Data Tools, repaired visual studio and SQL server. Still no luck. This is driving me crazy.Sublunary
I have the Exact same problemAbnaki
The problem turned out to be VS 2013 Update 3. Reinstalled and didn't do the update (so stayed on Update 2) and it works perfectly.Sublunary
It looks like this still isn't fixed as of Update 4 either ...Gunboat
S
1

It turns out the issue was with Visual Studio Update 3. I uninstalled and reinstalled VS 2013 to Update 2 only and reinstalled Data Tools and it works perfectly now.

Sublunary answered 19/9, 2014 at 7:17 Comment(2)
Hi @GooseZA, where do you find the VS2013 with Update 2? I only have Vs2013 Update 3 in my msdn... Thanks in advance.Abnaki
Hi @Goose, I uninstalled VS 2013 and reinstalled to Update 2, but you mentioned you also reinstalled Data Tools. How do you do that? As mine still broken (same error) on Vs2013 Update 2... ThanksAbnaki
C
52

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!

Condescendence answered 10/12, 2014 at 13:54 Comment(3)
This solution worked for me with VS2013 (Update 4) installed.Disposed
For my VS2013 (Community Edition with Update 4) this solution worked as well.Kostival
I already had it installed but it must have got corrupted - a install/repair worked.Peh
H
18

In Visual Studio 2013 -> Tools -> Extensions and Updates... -> Updates -> Product Updates -> Microsoft SQL Server Update for database to 12.0.50318.0

I was upgrading from 12.0.41012.0 and this resolved my issue. This relates to the answer to install the latest SQL Server Data Tools.

Horologe answered 13/5, 2015 at 21:13 Comment(2)
This solved it for me, upgraded from 12.0.41012.0 to 12.0.50730.0Finnigan
its resolved my problem, i just update the SQL Server by VS2013. thanks @BrandonWestlund
F
6

I am using Visual Studio Community 2013.

I had same error:

You can fix it by updating the SQL Server Tools:

Tools --> Extensions and Updates

enter image description here

Then under Product Updates you will see an option to update SQL Server Update.

Click on Update, after it has installed restart Visual Studio.

enter image description here

Fondness answered 6/10, 2015 at 9:30 Comment(0)
B
4

Try:

  1. Install the latest DacFx from http://www.microsoft.com/en-us/download/details.aspx?id=43370
  2. Reinstall the latest SSDT from http://go.microsoft.com/fwlink/?LinkID=393521

Source: VS2013 SqlBuildTask 04018 Error

Baby answered 27/11, 2014 at 11:14 Comment(0)
L
3

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

Ladon answered 19/9, 2014 at 14:0 Comment(0)
F
3

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.

Favian answered 13/2, 2015 at 14:59 Comment(2)
This was the problem for me and my comrade. He also had .targets files from 2013 in C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\SSDT but he didn't have "good" ones in the v11.0 folder. I emailed him the ones from my computer. That lead us to another build error which revealed that he needed to update Sql Server.Km
this saved my comrade and I so much time!Zsa
S
1

It turns out the issue was with Visual Studio Update 3. I uninstalled and reinstalled VS 2013 to Update 2 only and reinstalled Data Tools and it works perfectly now.

Sublunary answered 19/9, 2014 at 7:17 Comment(2)
Hi @GooseZA, where do you find the VS2013 with Update 2? I only have Vs2013 Update 3 in my msdn... Thanks in advance.Abnaki
Hi @Goose, I uninstalled VS 2013 and reinstalled to Update 2, but you mentioned you also reinstalled Data Tools. How do you do that? As mine still broken (same error) on Vs2013 Update 2... ThanksAbnaki
S
1

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.

Starspangled answered 30/5, 2015 at 16:3 Comment(0)
F
1

I had Visual Studio 2013 Update 5 installed and was having this issue. I followed these steps from above and that fixed the issue for me -->

In Visual Studio 2013 -> Tools -> Extensions and Updates... -> Updates -> Product Updates -> Microsoft SQL Server Update for database to 12.0.50730.0

Folium answered 29/9, 2015 at 16:39 Comment(1)
I ran a repair on Visual Studio 2013, but that did not fix the problem. I then ran a repair on the installed version of SSDT; this fixed the problem.Tempestuous
B
1

I had the same issue and just restart the Visual Studio and it works for me.

Baba answered 12/6, 2019 at 11:48 Comment(0)
A
1

I experienced the same issue with a slightly different stack trace:

Error MSB4018: The "SqlBuildTask" task failed unexpectedly. System.IO.IOException: The file exists.

Turns out this is a issue with the Temp directory for the service account I was using, I think if you exceed X number of folders/files in that directory the publish will no longer work. Fixed this issue by following the instructions mentioned here (for my service account):

  • Go start-> run
  • Type %temp% and click ok
  • Make sure you are in the folder /Local/Temp
  • Delete everything in this folder
Arsenic answered 26/8, 2020 at 14:50 Comment(0)
A
0

If it helps anybody, I installed VS2014 CTP 3, and I can build from it. Interestingly after a successfull build in vs2014, the next time you build in VS2013 it works. But subsequent builds in VS2013 dont work, until you rebuild in VS2014.

Abnaki answered 4/10, 2014 at 3:41 Comment(0)
C
0

I was able to fix the issue by repairing Microsoft SQL Server Data Tools and re-starting Visual Studio 2013. Control Panel > Right Click: "Microsoft SQL Server Data Tools" > Click: "Repair" > Re-Start Visual Studio

Caracole answered 2/3, 2016 at 22:17 Comment(0)
B
0

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

Burnard answered 26/1, 2017 at 8:32 Comment(0)
C
-1

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

Counterespionage answered 22/9, 2015 at 20:29 Comment(0)
F
-1

I had this problem and fixed it like this:

  1. install the latest DacFx from http://www.microsoft.com/en-us/download/details.aspx?id=43370

  2. Delete the Microsoft.Data.Tools.Schema.SqlTasks.targets file from C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\SSDT

  • repair SQL Server Data Tools 2013 , reset visual studio()
Feodora answered 7/5, 2021 at 10:47 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.