MSB0001: Внутренняя ошибка MSBuild: количество ссылок не должно быть меньше 1


Кто-нибудь знает, что это значит? Я получаю эту ошибку в своей сборке CI (CruiseControl.Net + NAnt + MSBuild), локально этот проект компилируется просто отлично...

My.Web.csproj: Error MSB4014: The build was aborted because of an internal failure.
Microsoft.Build.Shared.InternalErrorException: MSB0001: Internal MSBuild Error: refCount should not be less than 1.
   at Microsoft.Build.Shared.ErrorUtilities.ThrowInternalError(String message, Exception innerException, Object[] args)
   at Microsoft.Build.Collections.CopyOnWriteDictionary`2.CopyOnWriteBackingDictionary`2.get_HasNoClones()
   at Microsoft.Build.Collections.CopyOnWriteDictionary`2.set_Item(K key, V value)
   at Microsoft.Build.Collections.CopyOnWriteDictionary`2.System.Collections.IDictionary.set_Item(Object key, Object value)
   at Microsoft.Build.BuildEngine.BuildItem..ctor(String itemName, ITaskItem taskItem)
   at Microsoft.Build.BuildEngine.TaskEngine.GatherTaskItemOutputs(Lookup lookup, TaskOutput taskOutputSpecification, String itemName, String propertyName, Object outputs)
   at Microsoft.Build.BuildEngine.TaskEngine.GatherGeneratedTaskOutputs(Lookup lookup, TaskOutput taskOutputSpecification, String taskParameterName, String itemName, String propertyName, ITask task)
   at Microsoft.Build.BuildEngine.TaskEngine.GatherTaskOutputs(TaskExecutionMode howToExecuteTask, ITask task, ItemBucket bucket)
   at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult)
   at Microsoft.Build.BuildEngine.TaskEngine.ExecuteBucket(EngineProxy engineProxy, ItemBucket bucket, Int32 bucketNumber, TaskExecutionMode howToExecuteTask)
   at Microsoft.Build.BuildEngine.TaskEngine.ExecuteTask(TaskExecutionMode howToExecuteTask, Lookup lookup)
   at Microsoft.Build.BuildEngine.TaskExecutionState.TaskEngineExecuteTask(TaskEngine taskEngine, TaskExecutionMode howTaskShouldBeExecuted, Lookup lookup)
   at Microsoft.Build.BuildEngine.TaskExecutionState.ExecuteTask()
   at Microsoft.Build.BuildEngine.TaskExecutionModule.ExecuteTask(TaskExecutionState taskState)
   at Microsoft.Build.BuildEngine.TargetExecutionWrapper.SubmitNonIntrinsicTask(XmlElement taskNode, ITaskHost hostObject, ProjectBuildState buildContext)
   at Microsoft.Build.BuildEngine.TargetExecutionWrapper.ExecuteCurrentTask(ProjectBuildState buildContext)
   at Microsoft.Build.BuildEngine.TargetExecutionWrapper.ContinueRunningTasks(ProjectBuildState buildContext, TaskExecutionContext taskExecutionContext, Boolean startingFirstTask)
   at Microsoft.Build.BuildEngine.TargetExecutionWrapper.ContinueBuild(ProjectBuildState buildContext, TaskExecutionContext taskExecutionContext)
   at Microsoft.Build.BuildEngine.Project.ExecuteNextActionForProjectContext(ProjectBuildState buildContext, Boolean initialCall)
   at Microsoft.Build.BuildEngine.Project.CalculateNextActionForProjectContext(ProjectBuildState buildContext)
   at Microsoft.Build.BuildEngine.Project.ContinueBuild(ProjectBuildState buildContext, TaskExecutionContext taskExecutionContext)
   at Microsoft.Build.BuildEngine.Project.BuildInternal(BuildRequest buildRequest)
   at Microsoft.Build.BuildEngine.Engine.BuildProjectInternalInitial(BuildRequest buildRequest, Project project)
   at Microsoft.Build.BuildEngine.Engine.BuildProjectInternal(BuildRequest buildRequest, ProjectBuildState buildContext, TaskExecutionContext taskExecutionContext, Boolean initialCall)
   at Microsoft.Build.BuildEngine.Engine.EngineBuildLoop(BuildRequest terminatingBuildRequest)
   at Microsoft.Build.BuildEngine.Engine.PostProjectEvaluationRequests(Project project, String[] projectFiles, String[][] targetNames, BuildPropertyGroup[] globalPropertiesPerProject, IDictionary[] targetOutputsPerProject, BuildSettings buildFlags, String[] toolVersions)

Unexpected error while compiling project 'My.Web'

Exception has been thrown by the target of an invocation.

MSB0001: Internal MSBuild Error: refCount should not be less than 1.
2 2

2 ответа:

Я столкнулся с той же проблемой в аналогичной среде. В моем случае проект имел ссылку COM на библиотеку типов Active DS, которая не была установлена на сервере сборки.

Чтобы устранить проблему, я отбросил ссылку COM и добавил ссылку на сборку взаимодействия,которая затем была развернута на сервере сборки.

Нашел решение: вместо использования <solution> в цели сборки я вызвал msbuild напрямую с помощью <exec>. Теперь все работает.