gpt4 book ai didi

.net - 'System.__ComObject' 不包含 .WithComCleanup() 的定义

转载 作者:行者123 更新时间:2023-12-04 04:33:42 24 4
gpt4 key购买 nike

由于将项目从 VS2010 升级到 VS2012,我收到错误消息:

'System.__ComObject' does not contain a definition for .WithComCleanup())



运行此命令行代码时:
using (var cell = usedRange.Resource.Find(reservedWord, LookIn: XlFindLookIn.xlFormulas, After: usedRange.Resource.Cells[usedRange.Resource.Rows.Count, usedRange.Resource.Columns.Count]).WithComCleanup())

最佳答案

以为我会分享这个烦人问题的解决方案,在中间窗口中执行该行时,您会得到提示:

Embedded interop type 'Microsoft.Office.Interop.Excel.XlFindLookIn' is defined in both 'Excel.dll' and 'XYZ.ExcelAddin.ABC.dll'. Some operations on objects of this type are not supported while debugging. Consider casting this object to type 'dynamic' when debugging or building with the 'Embed Interop Types' property set to false.



我通过转 解决了这个问题将互操作类型嵌入到 False 引用 DLL Microsoft.Office.Interop.Excel

关于.net - 'System.__ComObject' 不包含 .WithComCleanup() 的定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20111912/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com