MSB0001:内部MSBuild错误:refCount不应小于1

本文关键字:小于 错误 内部 MSBuild MSB0001 refCount | 更新日期: 2023-09-27 18:21:00

有人知道这意味着什么吗?我在我的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.

MSB0001:内部MSBuild错误:refCount不应小于1

我在类似的环境中遇到了同样的问题。在我的案例中,该项目有一个对Active DS类型库的COM引用,该库没有安装在生成服务器上。

为了解决此问题,我删除了COM引用,并添加了对互操作程序集的引用,然后将该程序集部署到生成服务器。

找到了解决方案:我没有在构建目标中使用<solution>,而是直接用<exec>调用msbuild。现在一切正常。

我的问题与您类似,我必须在mobil环境中删除两个与我的解决方案相关的项目,这两个项目会导致与我的方案中的其他项目发生冲突。我的其他项目是桌面、mvc、webapi环境。

我必须为我的其他移动项目创建一个新的解决方案