gpt4 book ai didi

.net - 无法从装配中嵌入互操作类型

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

我知道以前曾在这里问过类似的问题,但我不确定它们是否能真正解决我的问题,除非我误解了它们。

我今天早上一直在开发应用程序,构建或重建解决方案没有任何问题,但是在吃了午饭然后又回来了(我将程序保持打开状态)之后,突然无法构建它,因为它是返回3个错误,例如我以前从未遇到过的错误。

错误1:

Cannot embed interop types from assembly 'office' because it is missing either the 'ImportedFromTypeLib' attribute or the 'PrimaryInteropAssembly' attribute.



错误2:

Cannot embed interop types from assembly 'office' because it is missing the 'Guid' attribute



错误3:

Unable to load referenced library 'C:\WINDOWS\assembly\GAC_MSIL\Office\15.0.0.0__71e9bce111e9429c\Office.dll': The system cannot find the file specified. C:\WINDOWS\assembly\GAC_MSIL\Office\15.0.0.0__71e9bce111e9429c\Office.dll



是什么导致这些错误突然发生?

检入“项目属性”>“引用”>“添加”>“COM”之后,我可以看到已引用Office 15.0对象库。那我该怎么办?他们似乎是在应用程序打开时出现的,这很奇怪吗?

最佳答案

只是这样,对于永恒的其余部分和任何潜在的具有相同问题的 future 用户来说,这并非没有标记,答案就是@soohoonigan和@TnTinMn所建议的:

  • 清洁并重建解决方案。
  • 如果不起作用,请删除引用,然后再次重新添加它们。
  • 关于.net - 无法从装配中嵌入互操作类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39491801/

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