Giter Site home page Giter Site logo

onenotevanilla5's Introduction

OneNoteVanilla5

Demo a vanilla OneNote add-in using .NET 5.0

https://github.com/dotnet/core-setup/blob/master/Documentation/design-docs/COM-activation.md

  • .NET Framework used mscoree.dll as a shim to bootrap COM activation
  • .NET Core uses comhost.dll and one is generated for the project; see Install.reg

How-to

Setup

Requirements: Visual Studio 16.8 or higher, .NET 5.0 SDK

Create Project

  1. Visual Studio -> Create a new project

  2. C#/Windows/Library -> Choose Class Library

  3. Enter names

  4. Target Framework -> .NET 5.0

  5. Edit the csproj file:

    Change the TargetFramework to net5.0-windows and enable COM hosting

    <TargetFramework>net5.0-windows</TargetFramework>
    <EnableComHosting>true</EnableComHosting>

    To use Windows Forms, add the UseWindowsForms element

    true

Add Dependencies

  1. Add COM reference Microsoft.Office 16.0 Object Library
    This adds Interop.Microsoft.Office.Core

    a. Note that some people have found it necessary to enable Embed Interop Type in the dependency proeprties but it seems to work without it.

  2. Add COM reference Microsoft OneNote 15.0 Type Library
    This adds Interop.Microsoft.Office.Interop.OneNote

    a. Note that some people have found it necessary to enable Embed Interop Type in the dependency proeprties but it seems to work without it.

  3. Browse to reference \Common7\IDE\PublicAssemblies\extensibility.dll
    This adds Extensiblity

Create AddIn class

  1. Create a new class (or rename the default Class1.cs) for the addin
    The name can be anything you want

  2. Add these using statements

    using Microsoft.Office.Core;
    using Microsoft.Office.Interop.OneNote;
  3. Add the following attributes to the addin class

    [ComVisible(true)]
    [Guid("4D86B2FD-0C2D-4610-8916-DE24C4BB70B5")]
    [ProgId("OneNoteVanilla5")]

    replacing the Guid with your own unique Guid
    replacing the ProgId with a unique ID; this will be recorded in the System Registry

  4. Extend the class with these interfaces:

    : IDTExtensibility2     // adds lifetime handlers to the addin
    : IRibbonExtensibility  // adds ribbon handlers to the addin

onenotevanilla5's People

Contributors

stevencohn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.