简体   繁体   中英

Issues with EPiServer.TinyMCESpellChecker / NHunspell

During a reinstallation of the EPiServer.TinyMCESpellChecker package, I was having problems with the NHunspell dependency. Trying out the SpellChecker would show a browser alert message with the HTML of an error page on it, with the message that it was unable to find NHunspellx86.DLL. I checked my bin/ folder, and indeed the DLL was missing. What was stranger was that it was present in the nuget packages/ folder for the NHunspell install.

Here is the error message that showed when I reinstalled NHunspell in particular:

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

As it turns out, the error message was appearing because the NHunspellx86 and NHunspellx64 DLLs are in the content folder of the nuget package. What this means is that if the file is present in your solution, it does not get overwritten. In order to resolve the error, I had to force uninstall NHunspell (force because I wanted nuget to ignore that the EPiServer spellchecker depended on it):

uninstall-package nhunspell -Force

and then delete the NHunspellx86 and NHunspellx64 DLL's in the root of my website project . Turns out, the original installation of EPiServer.TinyMCESpellChecker had put them there, and the fact that they existed was preventing nuget from reinstalling the package correctly by copying over the DLL's from the content tab. After you've deleted both DLL's, run the following:

install-package nhunspell 

Now the console should show NHunspell installing without errors, and when your run EPiServer again, the TinyMCESpellchecker should work without errors!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM