EPiServer.TinyMCESpellChecker/NHunspell 的问题

Issues with EPiServer.TinyMCESpellChecker / NHunspell

在重新安装 EPiServer.TinyMCESpellChecker 软件包期间,我遇到了 NHunspell 依赖项的问题。试用 SpellChecker 会显示一条浏览器警告消息,其中包含错误页面的 HTML,以及无法找到 NHunspellx86.DLL 的消息。我检查了我的 bin/ 文件夹,确实缺少 DLL。奇怪的是它出现在 NHunspell 安装的 nuget packages/ 文件夹中。

以下是我重新安装 NHunspell 时显示的错误消息:

PM> update-package -reinstall nhunspell
Attempting to gather dependency information for multiple packages with respect to project 'Guthrie.Web', targeting '.NETFramework,Version=v4.6.2'
Gathering dependency information took 7.41 sec
Attempting to resolve dependencies for multiple packages.
Resolving dependency information took 0 ms
Resolving actions install multiple packages
Retrieving package 'NHunspell 1.2.5554.16953' from 'nuget.org'.
Removed package 'NHunspell 1.2.5554.16953' from 'packages.config'
Successfully uninstalled 'NHunspell 1.2.5554.16953' from Guthrie.Web
Package 'NHunspell.1.2.5554.16953' already exists in folder 'C:\TFS2013\ClientGITCollection\Guthrie\GuthrieEpi\packages'
'Hunspellx86.dll' already exists. Skipping...
'Hunspellx64.dll' already exists. Skipping...
Added package 'NHunspell.1.2.5554.16953' to 'packages.config'
Executing script file 'C:\TFS2013\ClientGITCollection\Guthrie\GuthrieEpi\packages\NHunspell.1.2.5554.16953\tools\install.ps1'
Value does not fall within the expected range.
At C:\TFS2013\ClientGITCollection\Guthrie\GuthrieEpi\packages\NHunspell.1.2.5554.16953\tools\install.ps1:4 char:1
+ $hunspellx86Dll = $project.ProjectItems.Item("Hunspellx86.dll")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], ArgumentException
    + FullyQualifiedErrorId : System.ArgumentException

You cannot call a method on a null-valued expression.
At C:\TFS2013\ClientGITCollection\Guthrie\GuthrieEpi\packages\NHunspell.1.2.5554.16953\tools\install.ps1:5 char:1
+ $hunspellx86Dll.Properties.Item("BuildAction").Value = 0 # BuildActio ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\TFS2013\ClientGITCollection\Guthrie\GuthrieEpi\packages\NHunspell.1.2.5554.16953\tools\install.ps1:6 char:1
+ $hunspellx86Dll.Properties.Item("CopyToOutputDirectory").Value = 2 #  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Value does not fall within the expected range.
At C:\TFS2013\ClientGITCollection\Guthrie\GuthrieEpi\packages\NHunspell.1.2.5554.16953\tools\install.ps1:10 char:1
+ $hunspellx64Dll = $project.ProjectItems.Item("Hunspellx64.dll")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], ArgumentException
    + FullyQualifiedErrorId : System.ArgumentException

You cannot call a method on a null-valued expression.
At C:\TFS2013\ClientGITCollection\Guthrie\GuthrieEpi\packages\NHunspell.1.2.5554.16953\tools\install.ps1:11 char:1
+ $hunspellx64Dll.Properties.Item("BuildAction").Value = 0 # BuildActio ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\TFS2013\ClientGITCollection\Guthrie\GuthrieEpi\packages\NHunspell.1.2.5554.16953\tools\install.ps1:12 char:1
+ $hunspellx64Dll.Properties.Item("CopyToOutputDirectory").Value = 2 #  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Successfully installed 'NHunspell 1.2.5554.16953' to Guthrie.Web

事实证明,出现错误消息是因为 NHunspellx86 和 NHunspellx64 DLL 位于 nuget 包的内容文件夹中。这意味着如果文件存在于您的解决方案中,它不会被覆盖。为了解决这个错误,我不得不强制卸载 NHunspell(强制卸载是因为我想让 nuget 忽略 EPiServer 拼写检查器依赖它):

uninstall-package nhunspell -Force

然后删除我网站项目根目录中的 NHunspellx86 和 NHunspellx64 DLL。事实证明,EPiServer.TinyMCESpellChecker 的原始安装已将它们放在那里,并且它们存在的事实阻止了 nuget 通过从内容选项卡复制 DLL 来正确地重新安装包。删除两个 DLL 后,运行 如下:

install-package nhunspell 

现在控制台应该显示 NHunspell 安装没有错误,当你的 运行 EPiServer 再次出现时,TinyMCESpellchecker 应该可以正常工作!