MSBuild在解析COM引用时失败。为什么?

时间:2010-08-30 12:40:04

标签: .net msbuild

我的构建服务器突然停止工作。在我检查了日志文件后,我发现了怪物错误消息:

 error MSB4018: The "ResolveComReference" task failed unexpectedly.
 error MSB4018: System.ApplicationException: The directory name is invalid. (Exception from HRESULT: 0x8007010B)
 error MSB4018: 
 error MSB4018: Server stack trace: 
 error MSB4018:    at System.Reflection.Assembly.nDefineVersionInfoResource(String filename, String title, String iconFilename, String description, String copyright, String trademark, String company, String product, String productVersion, String fileVersion, Int32 lcid, Boolean isDll)
 error MSB4018:    at System.Reflection.Emit.AssemblyBuilder.SaveNoLock(String assemblyFileName, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
 error MSB4018:    at System.Reflection.Emit.AssemblyBuilder.Save(String assemblyFileName, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
 error MSB4018:    at Microsoft.Build.Tasks.TlbReference.WriteWrapperToDisk(AssemblyBuilder assemblyBuilder, String wrapperPath)
 error MSB4018:    at Microsoft.Build.Tasks.TlbReference.GenerateWrapper(ComReferenceWrapperInfo& wrapperInfo)
 error MSB4018:    at Microsoft.Build.Tasks.ResolveComReference.ResolveComReferenceTlb(ComReferenceInfo referenceInfo, StringoutputDirectory, String refName, Boolean topLevelRef, ComReferenceWrapperInfo& wrapperInfo)
 error MSB4018:    at Microsoft.Build.Tasks.ResolveComReference.ResolveComClassicReference(ComReferenceInfo referenceInfo, String outputDirectory, String wrapperType, String refName, Boolean topLevelRef, ComReferenceWrapperInfo& wrapperInfo)
 error MSB4018:    at Microsoft.Build.Tasks.ResolveComReference.Microsoft.Build.Tasks.IComReferenceResolver.ResolveComClassicReference(TYPELIBATTR typeLibAttr, String outputDirectory, String wrapperType, String refName, ComReferenceWrapperInfo& wrapperInfo)
 error MSB4018:    at Microsoft.Build.Tasks.ResolveComReference.ScanAndResolveAllDependencies(ComDependencyWalker dependencyWalker, ComReferenceInfo reference)
 error MSB4018:    at Microsoft.Build.Tasks.ResolveComReference.ResolveReference(ComDependencyWalker dependencyWalker, ComReferenceInfo referenceInfo, String outputDirectory, ITaskItem& referencePathItem)
 error MSB4018:    at Microsoft.Build.Tasks.ResolveComReference.ResolveReferenceAndAddToList(ComDependencyWalker dependencyWalker, ComReferenceInfo projectRefInfo, ArrayList resolvedReferenceList, ArrayList moduleList)
 error MSB4018:    at Microsoft.Build.Tasks.ResolveComReference.Execute()
 error MSB4018:    at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
 error MSB4018:    at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
 error MSB4018:    at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
 error MSB4018: 
 error MSB4018: Exception rethrown at [0]: 
 error MSB4018:    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
 error MSB4018:    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
 error MSB4018:    at Microsoft.Build.Framework.ITask.Execute()
 error MSB4018:    at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult)

所有错误均来自c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(1418,9)

显然COM引用存在一些问题。我尝试重新注册所有这些,但我没有成功。

如何找到问题参考或至少如何诊断此问题?


编辑:当我在本地构建应用程序并将其复制到服务器时,它可以工作。所以只有构建需要的东西才有问题。

2 个答案:

答案 0 :(得分:2)

  

目录名无效

这是你真正的问题。

答案 1 :(得分:0)

Process Monitor揭示了MSBuild所做的最后一个合理的事情是在项目输出文件夹中为stdole.dll寻找interop库。这使我的事件更加困惑,因为我的项目没有直接依赖于该dll。

最后我重新启动了服务器,一切正常。对我感到羞耻。我应该先尝试重启。