报错warning CS0467、error CS0583,批量执行word文档间替换图片操作,

BUG反馈 · 787 次浏览
用户OGmxFdvxAgA 创建于 2023-11-21 03:09

脚本无问题,另外台电脑可正常执行,这台电脑报错,异常信息如下:
动作链接:https://getquicker.net/Sharedaction?code=69f419d4-7c8b-4310-360d-08db28db7b72

异常:c:\Users\HASEE\AppData\Local\Temp\CSSCRIPT\dynamic\12388.910b867a-b59d-4154-87dd-ba5b34254f30.tmp(33,21): warning CS0467: 方法“Microsoft.Office.Interop.Word._Document.Close(ref object, ref object, ref object)”和非方法“Microsoft.Office.Interop.Word.DocumentEvents2_Event.Close”之间存在二义性。将使用方法组。
c:\Users\HASEE\AppData\Local\Temp\CSSCRIPT\dynamic\12388.910b867a-b59d-4154-87dd-ba5b34254f30.tmp(35,16): warning CS0467: 方法“Microsoft.Office.Interop.Word._Application.Quit(ref object, ref object, ref object)”和非方法“Microsoft.Office.Interop.Word.ApplicationEvents4_Event.Quit”之间存在二义性。将使用方法组。
BUILD: error CS0583: 内部编译器错误(0xc0000005 位于地址 00007FF7882FBC91 处): 可能的原因是“CODEGEN”。
c:\Users\HASEE\AppData\Local\Temp\CSSCRIPT\dynamic\12388.910b867a-b59d-4154-87dd-ba5b34254f30.tmp(25,11): error CS0585: 内部编译器错误: 步骤“CODEGEN”
c:\Users\HASEE\AppData\Local\Temp\CSSCRIPT\dynamic\12388.910b867a-b59d-4154-87dd-ba5b34254f30.tmp(24,14): error CS0585: 内部编译器错误: 步骤“CODEGEN”
c:\Users\HASEE\AppData\Local\Temp\CSSCRIPT\dynamic\12388.910b867a-b59d-4154-87dd-ba5b34254f30.tmp(13,20): error CS0584: 内部编译器错误: 步骤“CODEGEN”的符号“DynamicClass.Exec(Quicker.Public.IStepContext)”
c:\Users\HASEE\AppData\Local\Temp\CSSCRIPT\dynamic\12388.910b867a-b59d-4154-87dd-ba5b34254f30.tmp(13,20): error CS0584: 内部编译器错误: 步骤“COMPILE”的符号“DynamicClass.Exec(Quicker.Public.IStepContext)”
c:\Users\HASEE\AppData\Local\Temp\CSSCRIPT\dynamic\12388.910b867a-b59d-4154-87dd-ba5b34254f30.tmp(13,20): error CS0584: 内部编译器错误: 步骤“COMPILE”的符号“DynamicClass.Exec(Quicker.Public.IStepContext)”
c:\Users\HASEE\AppData\Local\Temp\CSSCRIPT\dynamic\12388.910b867a-b59d-4154-87dd-ba5b34254f30.tmp(11,17): error CS0584: 内部编译器错误: 步骤“COMPILE”的符号“DynamicClass”
BUILD: error CS0584: 内部编译器错误: 步骤“COMPILE”的符号“<全局命名空间>”
BUILD: error CS0586: 内部编译器错误: 步骤“COMPILE”
BUILD: error CS0587: 内部编译器错误: 步骤“COMPILE”
BUILD: error CS0587: 内部编译器错误: 步骤“EMIT”
BUILD: error CS0587: 内部编译器错误: 步骤“BEGIN”

CL 最后更新于 2023/11/21

回复内容
CL 2023-11-21 07:14
#1

这看起来是底层.net的bug导致的,运行c#使用 v2 模式解决这个问题。


用户OGmxFdvxAgA 回复 CL 2023-11-21 09:12 :

改编运行模式后

异常:编译失败, Compilation, (14,32): error CS0234: The type or namespace name 'Word' does not exist in the namespace 'Microsoft.Office.Interop' (are you missing an assembly reference?) (39,38): error CS0234: The type or namespace name 'Word' does not exist in the namespace 'Microsoft.Office.Interop' (are you missing an assembly reference?) (39,94): error CS0234: The type or namespace name 'Word' does not exist in the namespace 'Microsoft.Office.Interop' (are you missing an assembly reference?) (45,47): error CS0103: The name 'WdSaveFormat' does not exist in the current context (46,49): error CS0103: The name 'WdCompatibilityMode' does not exist in the current context 代码: 1. using System; 2. using System.Text; 3. using System.Reflection; 4. using System.IO; 5. using System.Net; 6. using System.Net.Http; 7. using System.Collections; 8. using System.Collections.Generic; 9. using System.Collections.Concurrent; 10. using System.Text.RegularExpressions; 11. using System.Threading.Tasks; 12. using System.Linq; 13. using System.Windows.Forms; 14. using Microsoft.Office.Interop.Word; 15. 16. namespace __ScriptExecution { 17. 18. public class __3nope0z9

CL 回复 用户OGmxFdvxAgA 2023-11-21 09:13 :

检查是不是缺少引用dll、声明必要的namespace。

用户OGmxFdvxAgA 2023-11-21 09:13
#2

运行c#使用 v2 模式

异常:编译失败, Compilation, (14,32): error CS0234: The type or namespace name 'Word' does not exist in the namespace 'Microsoft.Office.Interop' (are you missing an assembly reference?) (39,38): error CS0234: The type or namespace name 'Word' does not exist in the namespace 'Microsoft.Office.Interop' (are you missing an assembly reference?) (39,94): error CS0234: The type or namespace name 'Word' does not exist in the namespace 'Microsoft.Office.Interop' (are you missing an assembly reference?) (45,47): error CS0103: The name 'WdSaveFormat' does not exist in the current context (46,49): error CS0103: The name 'WdCompatibilityMode' does not exist in the current context 代码: 1. using System; 2. using System.Text; 3. using System.Reflection; 4. using System.IO; 5. using System.Net; 6. using System.Net.Http; 7. using System.Collections; 8. using System.Collections.Generic; 9. using System.Collections.Concurrent; 10. using System.Text.RegularExpressions; 11. using System.Threading.Tasks; 12. using System.Linq; 13. using System.Windows.Forms; 14. using Microsoft.Office.Interop.Word; 15. 16. namespace __ScriptExecution { 17. 18. public class __3nope0z9

回复主贴