The purpose of this project is to allow Notepad++ to integrate into the new Windows 11 right-click context menu. Doing this requires two new things.
To build this, the following steps needs to be taken:
To be able to build this project, the following is needed:
Just open the NppShell.sln Visual Studio solution, select Release as the build type, and do a Rebuild of the solution.
To generate a Sparse Package, you need to have the makeappx.exe tool in your PATH, the easiest way to do this is to run the Developer Command Prompt for VS 2022
command prompt, since it sets up the path.
Once inside the NppShell folder, run the following command to generate the Sparse Package:
makeappx pack /d .\Packaging /p .\NppShell.msix /nv
This takes the content of the Packaging directory, and packages them up into the msix file.
Now we have both the NppShell.dll
and NppShell.msix
files, we need to sign them with a valid certificate.
To do this, once again run the Developer Command Prompt for VS 2022
command prompt and change to the NppShell folder.
The following command expects the following:
Test1234
Make the needed changes to match the real certificate.
SignTool.exe sign /fd SHA256 /tr http://timestamp.digicert.com /td sha256 /a /f .\MyCert.pfx /p Test1234 /d "Notepad++" /du https://notepad-plus-plus.org/ NppShell.msix
SignTool.exe sign /fd SHA256 /tr http://timestamp.digicert.com /td sha256 /a /f .\MyCert.pfx /p Test1234 /d "Notepad++" /du https://notepad-plus-plus.org/ (ARCH)\Release\NppShell.dll
Now both files has been signed, and can be used.
The installer needs to deploy the two files into the same directory as notepad++.exe . They need to be there, since the DLL is looking for notepad++.exe in the same directory as it is located itself.
When the installer is running, after all the files has been copied into the program files directory, the follow command should be be run to run the register function to register the package:
regsvr32.exe /s .\contextmenu\NppShell.dll
Remember to wait for the regsvr32 process to exit before continuing.
When the uninstaller is running, it should run this command to unregister the package:
regsvr32.exe /s /u .\contextmenu\NppShell.dll
Here we need to wait for regsvr32 to finish, since if it isn't finished, the dll file will be locked by explorer.