Setup

Saturday, February 18, 2023

11:01 PM

Are you programmer? Please feel free to explore the source code and have a play. This section is chock full of technical references and information regarding how I develop and debug the OneNote add-in.

 

Please, mind the license       mpl-2.0     

 

Minimum Prerequisites and Configuration

 

  • Windows 10
  • Microsoft Visual Studio 2022 with VSTO and the Windows SDK and .NET Framework 4.8
  • Microsoft OneNote 2016 or later, 32-bit or 64-bit

 

Install Visual Studio Components

OneMore is developed in C# 9 under the .NET Framework. It will require Microsoft Visual Studio 2022; the Community edition is sufficient. (Note that VSCode cannot be used since it does not support COMReference entries in csproj files.)

 

While installing Visual Studio, you select componets to include as part of the installation using the Visual Studio Installer. If you already have VS installed, you can run the Visual Studio Installer to modify your installation and add these components.

 

.NET Framework 4.8

OneMore is currently developed using .NET Framework 4.8. Ensure that the SDK and targeting pack componets are selected.

 

 

Visual Studio Tools for Office

Add the Visual Studio Tools for Office (VSTO) component; this installs the necessary Primary Interop Assemblies for Office below C:\Program Files (x86)\Microsoft Visual Studio\Shared\Visual Studio Tools for Office\PIA\Office15. The Office interop assemblies are referenced by OneMore.csproj
 

 

Latest Version of the Windows SDK

OneMore references Windows.winmd out of the Windows SDK to consume PDF files and other features. Select the latest version of the SDK for your current OS, either Windows 10 or Windows 11. The winmd is expecting to exist at C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.version.0\Windows.winmd, where the version string is the version of the SDK you selected, for example 22621.

 

To automate the update of your csproj file, use the update-sdk.ps1 script as explained below under the heading Upgrade OneMore Project References.

 

 

Install Visual Studio Installer Projects Extension

Install the Visual Studio 2022 Installer Projects extension. This extension is used to build the Setup project for OneMore. Installing this extension can be automated using the provided install-vsix.ps1 script located in the OneMore repo:

 

PS C:\Github\OneMore> .\install-vsix.ps1

 

Configure NuGet Options

Ensure that nuget.org ( https://api.nuget.org/v3/index.json) is included in the NuGet Package Sources in the Visual Studio Options

 

 

Update OneMore Project References

Windows SDK versions are released frequently so it's likely that you have a different version than is currently in OneMore.csproj. If so then you must replace the reference hints in OneMore.csproj to include your version of the SDK. This can be automated using the provided update-sdk.ps1 script located in the OneMore repo:

 

PS C:\Github\OneMore> .\update-sdk.ps1

 

Install OneMore and Setup Registry

Either download the latest release of OneMore or build the solution and run the generated MSI. This will create the initial Registry settings including the add-in COM registration pointing to the InprocServer32 path. You'll want to redirect these paths to your development tree so you won't have to continually copy the DLLs around.

 

  • Run the setregistry.ps1 script as explained on the Scripts page to redirect the settings to your development folders.
  • Optionally, run the included iq.ps1  to confirm the settings are OK; this will work with any registered path

 

Recently Tested With

 

  • Windows 11 Pro 22H2 22621.1344
  • Windows 11 SDK 10.0.22621.0
  • Visual Studio 2022 17.5.1
  • OneNote® 2021 MSO (Version 2302 Build 16.0.16130.20186) 64-bit

 

Dependencies

This is a list of nuget packages and libraries that OneMore depends on and are required to build. The nuget packages require that VS Nuget Package Manager settings include a link to https://api.nuget.org/v3/index.json.

 

  • Chinese - nuget, MIT license
    • Used by Word Count command for Chinese text
  • HtmlAgilityPack - nuget, MIT license
    • Normalizes HTML and non-conformant XML to well-formed XML that can be consumed by XElement.Parse
  • InputSimulator - nuget, MIT license
    • Replaces the use of SendKeys.Send, adding support for multilingual keyboards
  • Markdig.Signed - nuget. BSD-2 license
    • A fast, powerful, CommonMark compliant, extensible Markdown processor for .NET
  • Newtonsoft.Json - nuget, MIT license
    • Json.NET is a popular high-performance JSON framework for .NET

 

 

#omwiki #omdeveloper

 

© 2020 Steven M Cohn. All rights reserved.

Please consider a sponsorship or one-time donation to support ongoing development

 

 

 

Created with OneNote.