This page provides documentation for anyone working with the NAPS2 source code.
You can open the NAPS2 solution with Visual Studio 2022 Community or Rider.
NAPS2 has a dedicated set of command line tools for building, testing, and packaging. These build on top of the normal dotnet CLI.
The NAPS2 solution has a number of projects:
NAPS2.Sdkis available as a Nuget package and is designed to be reusable. See the doc and samples. Sdk projects are provided under a less restrictive license (LGPL).
NAPS2.Imagesprojects provide an abstraction used by NAPS2.Sdk to work with native image types on each platform (Gdi: System.Drawing, Mac: NSImage, Gtk: PixBuf).
NAPS2.Libprojects are specific to the NAPS2 desktop application. The main Lib project has most of the NAPS2 desktop code while subprojects (WinForms, Mac, Gtk) have platform-specific code.
NAPS2.Appprojects generate actual executables for NAPS2 applications. Note that Mac and Gtk executables are multi-purpose (i.e. they can operate in desktop, console, or worker mode) while WinForms has separate .Console and .Worker executables.
NAPS2.Setupcontains installer configuration files and other files that don't have anywhere else to go.
NAPS2.Toolsprovides a command-line tool "n2" for various development tasks (e.g. packaging) and isn't otherwise distributed. See doc.
And test projects:
NAPS2.Sdk.Tests- General tests for NAPS2.Sdk, NAPS2.Images, and the NAPS2.Images.* project corresponding to the current platform.
NAPS2.Sdk.ScannerTests- Tests that can be manually run to verify functionality with a real scanner. See HowToRunScannerTests.cs.
NAPS2.Lib.Tests- General tests for NAPS2.Lib.
NAPS2.App.Tests- Tests that run against real executables and packages, including GUI automation tests. Some tests are designed to run with "n2 verify".
Also see related repositories:
Gmail and Outlook Web Access integration (for the "Email PDF" button) require client credentials to be set up for each service. If you want to include support in a custom build you will need to get your own set of credentials.
Create a file named
NAPS2.Lib\google.credentials.json that you get from the
Google Api Console (help).
Create a file named
NAPS2.Lib\microsoft.credentials.json and set "client_id" and "client_secret" from the
Microsoft Application Portal (generate a password for "client_secret").
You will also need to set up web redirect URIs to
http://127.0.0.1:50320/ as well as for ports