CS0012类型“ XtraReport”在未引用的程序集中定义

时间:2018-11-07 21:24:01

标签: asp.net-mvc-5

我最近将视觉工作室更新为2017 Enterprise。 我曾经用过DevExpress v15.1 今天,我将DevExpress升级到版本18.1,并且在构建.Net MVC5应用程序解决方案时,出现以下错误

  

“ XtraReport”类型是在不是   参考。您必须添加对程序集的引用   'DevExpress.XtraReports.v15.1,版本= 15.1.8.0,文化=中性,   PublicKeyToken = b88d1754d700e49a'。

上述错误位于ReportController.cs

我检查了项目下的引用文件夹,发现其中有DevExpress.XtraReports.v18.1。

此错误可能是什么原因?。

谢谢您的帮助。

1 个答案:

答案 0 :(得分:0)

根据消息,XtraReport仍引用其DLL程序集的旧版本:

Traceback (most recent call last):
  File "C:\Users\Ajit\AppData\Local\conda\conda\envs\phd\lib\site-packages\tornado\web.py", line 1592, in _execute
    result = yield result
  File "C:\Users\Ajit\AppData\Local\conda\conda\envs\phd\lib\site-packages\tornado\gen.py", line 1133, in run
    value = future.result()
  File "C:\Users\Ajit\AppData\Local\conda\conda\envs\phd\lib\site-packages\tornado\gen.py", line 1141, in run
    yielded = self.gen.throw(*exc_info)
  File "C:\Users\Ajit\AppData\Local\conda\conda\envs\phd\lib\site-packages\notebook\services\sessions\handlers.py", line 73, in post
    type=mtype))
  File "C:\Users\Ajit\AppData\Local\conda\conda\envs\phd\lib\site-packages\tornado\gen.py", line 1133, in run
    value = future.result()
  File "C:\Users\Ajit\AppData\Local\conda\conda\envs\phd\lib\site-packages\tornado\gen.py", line 1141, in run
    yielded = self.gen.throw(*exc_info)
  File "C:\Users\Ajit\AppData\Local\conda\conda\envs\phd\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 79, in create_session
    kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
  File "C:\Users\Ajit\AppData\Local\conda\conda\envs\phd\lib\site-packages\tornado\gen.py", line 1133, in run
    value = future.result()
  File "C:\Users\Ajit\AppData\Local\conda\conda\envs\phd\lib\site-packages\tornado\gen.py", line 1141, in run
    yielded = self.gen.throw(*exc_info)
  File "C:\Users\Ajit\AppData\Local\conda\conda\envs\phd\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 92, in start_kernel_for_session
    self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
  File "C:\Users\Ajit\AppData\Local\conda\conda\envs\phd\lib\site-packages\tornado\gen.py", line 1133, in run
    value = future.result()
  File "C:\Users\Ajit\AppData\Local\conda\conda\envs\phd\lib\site-packages\tornado\gen.py", line 326, in wrapper
    yielded = next(result)
  File "C:\Users\Ajit\AppData\Local\conda\conda\envs\phd\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 160, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "C:\Users\Ajit\AppData\Local\conda\conda\envs\phd\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
    km.start_kernel(**kwargs)
  File "C:\Users\Ajit\AppData\Local\conda\conda\envs\phd\lib\site-packages\jupyter_client\manager.py", line 259, in start_kernel
    **kw)
  File "C:\Users\Ajit\AppData\Local\conda\conda\envs\phd\lib\site-packages\jupyter_client\manager.py", line 204, in _launch_kernel
    return launch_kernel(kernel_cmd, **kw)
  File "C:\Users\Ajit\AppData\Local\conda\conda\envs\phd\lib\site-packages\jupyter_client\launcher.py", line 128, in launch_kernel
    proc = Popen(cmd, **kwargs)
  File "C:\Users\Ajit\AppData\Local\conda\conda\envs\phd\lib\subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "C:\Users\Ajit\AppData\Local\conda\conda\envs\phd\lib\subprocess.py", line 997, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

通常会出现此问题,因为升级后Project Converter无法更新'DevExpress.XtraReports.v15.1, Version=15.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a' 相关参考。在这种情况下,您可以手动删除对旧程序集的所有引用(版本15.1),然后添加对新程序集的引用(版本18.1)。

还要确保web.config文件具有以下示例中的这些程序集信息(XtraReport指示修订号):

X

如果上述解决方案失败,请尝试导航至<add assembly="DevExpress.XtraReports.v18.1, Version=18.1.X.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" /> <add assembly="DevExpress.XtraReports.v18.1.Web, Version=18.1.X.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" /> X:\Windows\assembly代表系统驱动器号),将程序集安装到全局程序集缓存(GAC),然后将所有新的DevExpress程序集复制到该程序集文件夹(包括X),如this issue中所述。

相关问题:

Errors after upgrading DevExpress version

DevExpress.XtraReports.UI.XtraReport is not defined after upgrade

The type 'DevExpress.XtraReports.UI.XtraReport' is defined in an assembly that is not referenced