MSBUILD fails randomly with "Version store out of memory (cleanup already attempted)" errors - MSB4018 - by Mike Ruthruff

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


26
0
Sign in
to vote
ID 749108 Comments
Status Closed Workarounds
Type Bug Repros 13
Opened 6/14/2012 9:12:24 AM
Access Restriction Public

Description

I am encountering what seems to be a random problem when building SSDT solutions using MSBUILD from the VS11 beta .net framework.   Somewhat randomly when issuing build commands from a powershell prompt the build fails and with the callstack output show below.  If I close and reopen the prompt it will temporarily correct this problem however it seems to resurface after building the project a number of times. 
 
Something that might be related is that I recently went from about 3 .sqlproj's in the solution to 9 .sqlproj's in the solution,  The solution contains only database project types. 
 
I haven't been able to reproduce the failure when building from within VS, the problem only occurs when building the solution using MSBUILD.  This looks like a bug to me. 

A reliable workaround seems to be to reduce the parallellism of the build to 1. 
 
MSBUILD command being used:
 
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe DB.sln /target:build /m:8 /nodeReuse:false /property:Configuration=test /noconsolelogger /l:FileLogger,Microsoft.Build.Engine;logfile=.\projectLog.txt;verbosity=normal;append=true
 
Callstack from error:
 
   C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(495,5): error MSB4018: The "SqlBuildTask" task failed unexpectedly.
        C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(495,5): error MSB4018: Microsoft.Isam.Esent.Interop.EsentVersionStoreOutOfMemoryException: Version store out of memory (cleanup already attempted)
        C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(495,5): error MSB4018:    at Microsoft.Isam.Esent.Interop.Update.Save(Byte[] bookmark, Int32 bookmarkSize, Int32& actualBookmarkSize)
        C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(495,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.EseCommand.InsertRowWithFirstIdentityColumn(Object[] values)
        C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(495,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.CreateIdentifierImpl(Int32 externalPartsId, ICollection`1 parts)
        C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(495,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlSchemaModel.RegisterAliasedToDboElements(String logicalSourceName, IEnumerable`1 elements)
        C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(495,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlSchemaModel.OnCustomDataAdded(CustomSchemaData customData)
 
Sign in to post a comment.
Posted by Phil Parkin on 7/3/2015 at 4:03 AM
We use VSOnline to licence VS Pro on our build server and it seems to have trouble keeping the licence up to date from month to month. Manually refreshing the licence credentials fixed the problem. This error message could be improved!
Posted by Phil Parkin on 6/3/2015 at 3:34 AM
This has just happened on our build server. SSDT 2013 / SQL Server 2014, TeamCity running the build.

[SqlBuildTask] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(550, 5): error MSB4018: The "SqlBuildTask" task failed unexpectedly.
Microsoft.Isam.Esent.Interop.EsentVersionStoreOutOfMemoryException: Version store out of memory (cleanup already attempted)
at Microsoft.Isam.Esent.Interop.Api.Check(Int32 err)
at Microsoft.Isam.Esent.Interop.Api.JetUpdate(JET_SESID sesid, JET_TABLEID tableid, Byte[] bookmark, Int32 bookmarkSize, Int32& actualBookmarkSize)
at Microsoft.Isam.Esent.Interop.Update.Save(Byte[] bookmark, Int32 bookmarkSize, Int32& actualBookmarkSize)
at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.EseCommand.InsertRow(Object[] values)
at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.RelationshipEntry.AddAnnotation(IModelAnnotation annotation)
.........................
Posted by Luis Fraile on 6/2/2015 at 4:48 AM
I'm havinng this issue also, with 2013.4 (VS and TFS) and latest version of SSDT :(
Posted by Rick Glos on 12/8/2014 at 10:50 AM
This issue just occurred on our build server after a large number of builds and never having seen this before.
Posted by gus1691 on 8/8/2014 at 5:39 PM
Ditto, I started to experience the same issue after the July 2014 SSDT release and more frequently with the Visual Studio 2013 Update 3 patch.
Posted by wojtek.slupski on 8/8/2014 at 1:10 AM
This started happening yesterday, after I installed the latest updates for Visual Studio 2013 (they were TFS related I think so I'm not sure if this is the case)
Posted by MediaNick on 8/5/2014 at 6:01 AM
I regularly experienced this issue last year prior to the SSDT release that supported the CmdLineInMemoryStorage switch, and once I started using that switch I hadn't experienced it again until now. I'm running the July 2014 SSDT release against a SQL Server 2014 localDb instance (12.0.2000.8), and every 10th build or so I get this error.

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(1016,5): error MSB4018: The "SqlStaticCodeAnalysisTask" task failed unexpectedly. [C:\Jenkins\jobs\DROM_Dev\workspace\DROM.Log\DROM.Log.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(1016,5): error MSB4018: Microsoft.Isam.Esent.Interop.EsentVersionStoreOutOfMemoryException: Version store out of memory (cleanup already attempted)

The sqlproj already contains the CmdLineInMemoryStorage switch (set to True). What is going on?
Posted by Mike Ruthruff on 2/26/2014 at 10:17 AM
It's mentioned below that this is fixed in a post-december data tools update by using this new switch
<CmdLineInMemoryStorage>True</CmdLineInMemoryStorage>

Can someone from Microsoft confirm that this fix is included in the January update? It looks like that is specific to PDW.
Posted by jagt70 on 8/16/2013 at 7:33 AM
This is marked as Fixed, so please can you provide details of the fix. I'm suffering from this bug and it fails sqlproj builds in our CI environment.
Posted by A_R_ on 6/26/2013 at 7:38 AM
How is it marked as fixed? I get this error every other day. Here is stacktrace:
Loading project references...
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018: The "SqlBuildTask" task failed unexpectedly. [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018: Microsoft.Isam.Esent.Interop.EsentVersionStoreOutOfMemoryException: Version store out of memory (cleanup already attempted) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Isam.Esent.Interop.Update.Save(Byte[] bookmark, Int32 bookmarkSize, Int32& actualBookmarkSize) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.EseCommand.InsertRow(Object[] values) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.InsertIntoCoreAnnotation(Type type, ModelIdentifier name, Int32 attachedCount, Int32 handle) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.CacheAnnotationData.Flush() [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.CacheBase`2.EnsureSpaceExists() [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.CacheBase`2.SetData(TKey key, TData data) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.CreateAnnotationImpl(Type type, ModelIdentifier identifier) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.CreateNamedAnnotation[TAnnotation](ModelIdentifier identifier) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.ReferenceLinker.MarkExternalReferencesWithAnnotations(ModelStore store) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.LoadExternals(TextReader input, String fileName, String logicalSourceName, IList`1 externalPartsSubstitution, Boolean suppressErrorsForMissingDependencies) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.OnCustomDataAdded(CustomSchemaData customData) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlSchemaModel.OnCustomDataAdded(CustomSchemaData customData) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.AddCustomData(CustomSchemaData customData, Boolean raiseEvents) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlModelBuilder.Add(CustomSchemaData customSchemaData) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.ModelBuilder.AddOrUpdate(CustomSchemaData customSchemaData) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Sql.Build.SqlTaskHost.AddOrUpdate(CustomSchemaData customSchemaData) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Tasks.Sql.TaskHostLoader.ProcessReferences(TaskLoggingHelper providedLogger, SqlTaskHost host, ErrorManager errors) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Tasks.Sql.TaskHostLoader.LoadImpl(ITaskHost providedHost, TaskLoggingHelper providedLogger, Boolean runAllBuildTimeValidationRules) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Tasks.Sql.TaskHostLoader.Load(ITaskHost providedHost, TaskLoggingHelper providedLogger, Boolean runAllBuildTimeValidationRules) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Tasks.Sql.SqlBuildTask.ExecuteLoadTaskHostStep() [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Tasks.Sql.SqlBuildTask.ExecuteStep(Func`1 step) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Tasks.Sql.SqlBuildTask.Execute() [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() [X:\\src\WWW.Database\WWW.Database.sqlproj]
(SqlBuild target) ->
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018: The "SqlBuildTask" task failed unexpectedly. [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018: Microsoft.Isam.Esent.Interop.EsentVersionStoreOutOfMemoryException: Version store out of memory (cleanup already attempted) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Isam.Esent.Interop.Update.Save(Byte[] bookmark, Int32 bookmarkSize, Int32& actualBookmarkSize) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.EseCommand.InsertRow(Object[] values) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.InsertIntoCoreAnnotation(Type type, ModelIdentifier name, Int32 attachedCount, Int32 handle) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.CacheAnnotationData.Flush() [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.CacheBase`2.EnsureSpaceExists() [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.CacheBase`2.SetData(TKey key, TData data) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.CreateAnnotationImpl(Type type, ModelIdentifier identifier) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.ModelStore.CreateNamedAnnotation[TAnnotation](ModelIdentifier identifier) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.ReferenceLinker.MarkExternalReferencesWithAnnotations(ModelStore store) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.LoadExternals(TextReader input, String fileName, String logicalSourceName, IList`1 externalPartsSubstitution, Boolean suppressErrorsForMissingDependencies) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.OnCustomDataAdded(CustomSchemaData customData) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlSchemaModel.OnCustomDataAdded(CustomSchemaData customData) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.AddCustomData(CustomSchemaData customData, Boolean raiseEvents) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlModelBuilder.Add(CustomSchemaData customSchemaData) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.ModelBuilder.AddOrUpdate(CustomSchemaData customSchemaData) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Sql.Build.SqlTaskHost.AddOrUpdate(CustomSchemaData customSchemaData) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Tasks.Sql.TaskHostLoader.ProcessReferences(TaskLoggingHelper providedLogger, SqlTaskHost host, ErrorManager errors) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Tasks.Sql.TaskHostLoader.LoadImpl(ITaskHost providedHost, TaskLoggingHelper providedLogger, Boolean runAllBuildTimeValidationRules) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Tasks.Sql.TaskHostLoader.Load(ITaskHost providedHost, TaskLoggingHelper providedLogger, Boolean runAllBuildTimeValidationRules) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Tasks.Sql.SqlBuildTask.ExecuteLoadTaskHostStep() [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Tasks.Sql.SqlBuildTask.ExecuteStep(Func`1 step) [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Tasks.Sql.SqlBuildTask.Execute() [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [X:\\src\WWW.Database\WWW.Database.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(509,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() [X:\\src\WWW.Database\WWW.Database.sqlproj]
Posted by Microsoft on 2/14/2013 at 12:43 PM
This looks like a problem with our file-backed storage. We're looking at the core problem, but I've added a command-line switch to our next SSDT release (post-December 2013) to force the msbuild commandline utilities to use an in-memory model. With the next release define <CmdLineInMemoryStorage>True</CmdLineInMemoryStorage> in the first PropertyGroup in your .sqlproj file.
Posted by MikeCousins on 2/1/2013 at 9:31 AM
We're also getting this error intermittently.

Have you guys had any luck with reducing the number of parallel builds to 1?
Posted by jhess001 on 11/20/2012 at 9:52 PM
I'm having a similar issue building 2 ssdt database projects from the command line in parallel with msbuild. I get the following exception most (but not all) of the time:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018: The "SqlBuildTask" task failed unexpectedly.\r [c:\TeamProjects\Development\Main\Source\Datab
ase\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018: System.ObjectDisposedException: Store must be open for this operation.\r [c:\TeamProjects\Dev
elopment\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path, FileMode mode, F
ileAccess access, FileShare share, Int32 bufferSize, IsolatedStorageFile isf)\r [c:\TeamProjects\Development\Main
\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at MS.Internal.IO.Packaging.PackagingUtilities.SafeIsolatedStorageFileStream..ctor(String
path, FileMode mode, FileAccess access, FileShare share, ReliableIsolatedStorageFileFolder folder)\r [c:\TeamProj
ects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at MS.Internal.IO.Packaging.PackagingUtilities.CreateUserScopedIsolatedStorageFileStreamWi
thRandomName(Int32 retryCount, String& fileName)\r [c:\TeamProjects\Development\Main\Source\Database\Temp\ISMIS\I
SMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at MS.Internal.IO.Packaging.SparseMemoryStream.SwitchModeIfNecessary()\r [c:\TeamProjects\
Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at MS.Internal.IO.Packaging.SparseMemoryStream.Write(Byte[] buffer, Int32 offset, Int32 co
unt)\r [c:\TeamProjects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at MS.Internal.IO.Packaging.DeflateEmulationTransform.Decompress(Stream source, Stream sin
k)\r [c:\TeamProjects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at MS.Internal.IO.Packaging.CompressEmulationStream..ctor(Stream baseStream, Stream tempSt
ream, Int64 position, IDeflateTransform transformer)\r [c:\TeamProjects\Development\Main\Source\Database\Temp\ISM
IS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at MS.Internal.IO.Packaging.CompressStream.ChangeMode(Mode newMode)\r [c:\TeamProjects\Dev
elopment\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at MS.Internal.IO.Packaging.CompressStream.Seek(Int64 offset, SeekOrigin origin)\r [c:\Tea
mProjects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Seek(Int64 offset, SeekOrigin origin
)\r [c:\TeamProjects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Read(Byte[] buffer, Int32 offset, Int32 cou
nt)\r [c:\TeamProjects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at System.IO.StreamReader.ReadBuffer(Char[] userBuffer, Int32 userOffset, Int32 desiredCha
rs, Boolean& readToUserBuffer)\r [c:\TeamProjects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at System.IO.StreamReader.Read(Char[] buffer, Int32 index, Int32 count)\r [c:\TeamProjects
\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at System.Xml.XmlTextReaderImpl.ReadData()\r [c:\TeamProjects\Development\Main\Source\Data
base\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at System.Xml.XmlTextReaderImpl.InitTextReaderInput(String baseUriStr, Uri baseUri, TextRe
ader input)\r [c:\TeamProjects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at System.Xml.XmlTextReaderImpl..ctor(String url, TextReader input, XmlNameTable nt)\r [c:
\TeamProjects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at System.Xml.XmlTextReader..ctor(TextReader input)\r [c:\TeamProjects\Development\Main\So
urce\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.CreateXmlReader(TextReader inpu
t)\r [c:\TeamProjects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.LoadExternals(TextReader input,
String fileName, String logicalSourceName, IList`1 externalPartsSubstitution, Boolean suppressErrorsForMissingDe
pendencies)\r [c:\TeamProjects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.AddReference(CustomSchemaData c
ustomData)\r [c:\TeamProjects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.OnCustomDataAdded(CustomSchemaD
ata customData)\r [c:\TeamProjects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlSchemaModel.OnCustomDataAdded(CustomSche
maData customData)\r [c:\TeamProjects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.DataSchemaModel.AddCustomData(CustomSchemaData
customData, Boolean raiseEvents)\r [c:\TeamProjects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlModelBuilder.Add(CustomSchemaData custom
SchemaData)\r [c:\TeamProjects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at Microsoft.Data.Tools.Schema.SchemaModel.ModelBuilder.AddOrUpdate(CustomSchemaData custo
mSchemaData)\r [c:\TeamProjects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Sql.Build.SqlTaskHost.AddOrUpdate(CustomSchemaData customSc
hemaData)\r [c:\TeamProjects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Tasks.Sql.TaskHostLoader.ProcessReferences(TaskLoggingHelpe
r providedLogger, SqlTaskHost host, ErrorManager errors)\r [c:\TeamProjects\Development\Main\Source\Database\Temp
\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Tasks.Sql.TaskHostLoader.LoadImpl(ITaskHost providedHost, T
askLoggingHelper providedLogger, Boolean runAllBuildTimeValidationRules)\r [c:\TeamProjects\Development\Main\Sour
ce\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Tasks.Sql.TaskHostLoader.Load(ITaskHost providedHost, TaskL
oggingHelper providedLogger, Boolean runAllBuildTimeValidationRules)\r [c:\TeamProjects\Development\Main\Source\D
atabase\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Tasks.Sql.SqlBuildTask.ExecuteLoadTaskHostStep()\r [c:\Team
Projects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Tasks.Sql.SqlBuildTask.ExecuteStep(Func`1 step)\r [c:\TeamP
rojects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at Microsoft.Data.Tools.Schema.Tasks.Sql.SqlBuildTask.Execute()\r [c:\TeamProjects\Develop
ment\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Ex
ecute()\r [c:\TeamProjects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(465
,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() [c:\TeamP
rojects\Development\Main\Source\Database\Temp\ISMIS\ISMIS.sqlproj]
Posted by Microsoft on 7/20/2012 at 3:06 PM
Hello Mike, this is Yang here. We still can't repro this issue yet, but we're working with the ESE team to pinpoint the possible root cause. Since you reported this issue via MS Connect, I need to follow up with you through this channel as required by the system :). Will keep you posted.

Thanks,
Yang