This topic provides information about the following:
What are NuGet Packages?
NuGet is the package manager for the Microsoft development platform that includes .NET. NuGet packages make it easy to add, remove, and update libraries and tools in Visual Studio projects that use the .NET Framework.
To read more about NuGet, please visit nuget.org.
Installing NuGet
The NuGet package manager is installed with Visual Studio, since version 2012.
Windows NuGet command line instruction for installation can be found at https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools
SmartZone NuGet Packages
Package dependencies are automatically handled.
SmartZone .Net NuGet packages are self-sufficient and provide all the necessary functionality for the package they describe. However, if you want to extend the package capabilities with functionality from other packages, you need to install those corresponding packages, too.
Package Id |
Description |
Assemblies |
Package Dependencies |
Accusoft.SmartZone.Net |
The SmartZone™ Combined NuGet package contains both the SmartZone™ ICR and SmartZone™ OCR packages, allowing you to perform both ICR and OCR recognition in one convenient package. |
All |
Accusoft.SmartZoneICR.Net Accusoft.SmartZoneOCR.Net |
Accusoft.SmartZoneICR.Net |
The SmartZone™ ICR component contains all the necessary objects, methods, and properties it takes for you to perform high accuracy zonal and full page ICR recognition. |
Accusoft.SmartZoneICR.Net.dll |
.NETFramework, Version=3.5 |
Accusoft.SmartZoneOCR.Net |
SmartZone™ OCR performs OCR recognition in user defined areas of interest (i.e zones) or full page. SmartZone OCR can be easily integrated with other Accusoft components into a robust forms-processing product. |
Accusoft.SmartZoneOCR.Net.dll |
.NETFramework, Version=3.5 Accusoft.SmartZone.Runtime.Win (>= 6.x.x)
|
Accusoft.SmartZone.Runtime.Win |
SmartZone language resources (win-x86, win-x64). |
None |
None |
Accusoft.SmartZone.Runtime.Asian.Win |
SmartZone Asian language resources (win-x86, win-x64). |
None |
Accusoft.SmartZone.Runtime.Win (>= 6.x.x) |
Note:
- Package Accusoft.SmartZone.Runtime.Latin.Win has been superseded by Accusoft.SmartZone.Runtime.Win.
- Packages Accusoft.SmartZone.Runtime.Win and (optional) Accusoft.SmartZone.Runtime.Asian.Win provide .props and .targets needed to copy native resources during builds. Visual Studio 2015 and 2017 projects should explicitly add these packages even if another NuGet package with this dependency has already been added to that project.
Adding SmartZone NuGet Packages
Once installed, SmartZone ICR and OCR will have evaluation mode activated by default. To continue developing or deploying with SmartZone, you will need a paid license. Refer to Licensing and Distributing for more information.
All of our packages can be found at nuget.org, which is the central package repository used by all package authors and consumers. The NuGet Package Manager is configured, by default, to use nuget.org for packages' sources.
From Visual Studio
- Open the NuGet Package Manager in Visual Studio by right-clicking on the project or solution in the Solution Explorer, and choose Manage NuGet packages.
- In the opened window make sure that Package source is set to nuget.org.
- Select Browse at the top-left of the page, and type Accusoft.SmartZone.Net into the search bar to find the package.
- Select the package on the left and then click the Install button on the right.
After installing the required package, you should see the newly added Accusoft.SmartZoneICR.Net and Accusoft.SmartZoneOCR.Net assemblies (and their dependencies) in your application's References folder.
- SmartZone OCR Asian Language Recognition requires installing the package Accusoft.SmartZone.Runtime.Asian.Win. If your app does not use SmartZone to recognize Chinese, Japanese, Korean, Thai or Vietnamese languages, this optional dependency can be omitted.
- Add the SmartZone ICR (or SmartZone OCR) namespace to any C# or VB.NET source file where you want to reference its classes:
using Accusoft.SmartZoneICRSdk;
using Accusoft.SmartZoneOCRSdk;
Native binaries and additional resources are copied to your app's output directory after building your project.
To learn more, we also recommend following the official tutorials available at nuget.org: https://docs.nuget.org/consume/package-manager-dialog
Customizing SmartZone NuGet Packages
Accusoft.SmartZone.Runtime.Win & Accusoft.SmartZone.Runtime.Asian.Win
The required OCR language resource files are copied to folder $(OutDir)assets after the MSBuild Target "Build" completes. By default, this directory is expected to be adjacent to the Accusoft.SmartZoneOCR.Net.dll assembly at runtime.
To change this location to a different directory:
- Override the MSBuild property Accusoft_SmartZone_OCRDataPath in your project.
<PropertyGroup>
<Accusoft_SmartZone_OCRDataPath>$(OutDir)my_app</Accusoft_SmartZone_OCRDataPath>
</PropertyGroup>
- Provide this new location to SmartZone OCR with its OCRDataPath property before recognition is performed.
Uninstalling the Accusoft.SmartZone.Runtime.Win and Accusoft.SmartZone.Runtime.Asian.Win packages does not delete resource files copied from building your application.
Troubleshooting
The troubleshooting section covers some common issues you may encounter and how to resolve them.
NuGet Package Restore Failed: (The Specified Path, File Name or Both are too long.)
NuGet Package restore failed for project [ProjectName]: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters... |
To remedy, do one of the following:
- Enable long path support. See article Long Path Support (NuGet CLI).
- Override the location in which to install NuGet packages using a nuget.config file with a repositoryPath (packages.config only) or globalPackagesFolder (projects using PackageReference only) to provide a shorter path. See article nuget-config-file reference.
- Relocate your project to a directory with a shorter path.
The Specified Path, File Name, or Both are Too Long. (Accusoft.SmartZone.Runtime.Win Only)
During a build, Target "CopyAccusoftSmartZoneRuntimeWin" can fail copying OCR language resources:
error MSB4023: Cannot evaluate the item metadata "%(Filename)". The item metadata "%(Filename)" cannot be applied to the path "XXXX". The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. |
To remedy, do one of the following:
Internal Error: Remote OCR engine initialization error. The provided search location for SmartZone.OCRDataPath may be invalid.
At runtime, an exception can result when SmartZoneOCR Reader.AnalyzeField is called and OCR language files are not found:
SmartZoneOCRException: Internal Error: Remote OCR engine initialization error. The provided search location for SmartZone.OCRDataPath may be invalid. |
This issue may be the result of misconfiguration or an incomplete build after NuGet packages are restored.
To remedy, try the following:
- Set OCRDataPath to the expected folder containing OCR language resource files before AnalyzeField is called. By default, this location is expected to be $(OutDir)assets, but can be overridden with MSBuild property $(Accusoft_SmartZone_OCRDataPath).
- Add the package Accusoft.SmartZone.Runtime.Win (and optionally Accusoft.SmartZone.Runtime.Asian.Win) to the Visual Studio project and rebuild.