Windows 11管理员无法运行gacutil.exe注册程序集的解决方法
无法在Win11生产机使用gacutil注册程序集以运行带Script Component的SSIS包
问题背景
- 开发机(DEV,Windows 11 Enterprise 64位,拥有本地管理员权限)使用VS2019创建包含Script Components的.dtsx包,因Visual Studio Tools for Applications (VSTA) 保存脚本和Script Component时不会保存添加的程序集,手动用
gacutil.exe注册相关程序集后,在VS2019中测试包运行正常。 - 生产机(PROD,同样是Windows 11 Enterprise 64位)使用
DTExec.exe执行包,无Script Components的包已通过该方式稳定运行超过一年,但带Script Components的包执行失败。
错误信息
执行SSIS包时的错误
Error: 2024-07-25 06:17:34.19 Code: 0xC0047062 Source: Data Flow Task Data Flow Task (SC Source [155]) Description: CS0234 - The type or namespace name 'Json' does not exist in the namespace 'System.Text' (are you missing an assembly reference?), main.cs, 17, 19 End Error
运行gacutil注册程序集时的错误
尝试以管理员身份运行gacutil.exe注册System.Text.Json.dll时,先弹出提示“This App can't run on your PC”,随后终端输出:
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools>gacutil.exe /if R:\shrdata\VICUSTSV\Inventory Management\Code\System.Text.Json.dll Access is denied.
已尝试的操作
- 重新安装PROD上的.NET SDK和.NET runtime,问题未解决;
- 通过VS2019 CLI运行
gacutil.exe,报错内容相同; - 检查
gacutil.exe权限,确认管理员账户拥有完全控制权限。
调研情况
- StackExchange建议为
GACUtil.exe设置Windows兼容性,但两台机器均为Win11且DEV正常运行,该方案暂不适用; - 找到“从DEV复制NETFX Tools文件夹到PROD”的方案,但认为这是极端临时 workaround,未解决根本问题。
现寻求可行方法,使gacutil能在PROD上成功注册程序集。
内容的提问来源于stack exchange,提问作者mrochek
相关产品推荐
相关产品推荐

