添加Infragistics DLL后仍遇编译LicenseException构建错误求助
问题描述
构建项目时触发以下LicenseException错误,且已确认相关DLL已添加至项目:
Exception occurred creating type 'Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter, Infragistics4.Win.UltraWinGrid.ExcelExport.v11.2, Version=11.2.20112.1010, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb' System.ComponentModel.LicenseException Uniprise.UGAF.Presentation.Fee ..\Presentation\Fee\licenses.licx 1
Error Exception occurred creating type 'Infragistics.Win.UltraWinGrid.UltraGrid, Infragistics4.Win.UltraWinGrid.v11.2, Version=11.2.20112.1010, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb' System.ComponentModel.LicenseException Uniprise.UGAF.Presentation.Fee ...\Presentation\Fee\licenses.licx 2
解决方案
- 校验licenses.licx条目:打开项目中的
licenses.licx文件,核对其中控件的版本号、PublicKeyToken是否与当前引用的Infragistics DLL完全一致。若不匹配,直接修改为正确信息,或删除对应条目后重新添加控件(Visual Studio会自动生成合规的许可证条目)。 - 重建许可证文件:删除
licenses.licx文件,在设计器中重新拖放UltraGrid和UltraGridExcelExporter控件,Visual Studio会自动生成正确的许可证记录。 - 验证Infragistics许可证状态:通过Infragistics License Manager工具检查本地是否安装了对应版本的有效许可证,若存在损坏或未激活情况,重新完成许可证激活。
- 清理重建项目:执行
Build > Clean Solution操作,删除项目的bin和obj目录后,重新构建解决方案。 - 检查DLL引用属性:确认项目中Infragistics DLL的
Copy Local属性设置为True,确保构建时DLL能正确复制到输出目录。
内容的提问来源于stack exchange,提问作者V.RANJITH

