Skip to content
  • Home
  • Work
  • About
  • Blog
  • Contact

Visio interop with .NET Core 3.0

John Goldsmith's profile image

John Goldsmith

06 February 2019
  • Code

There was an announcement last week of the second preview of .NET Core 3.0. Scrolling down the page, one item that caught my eye was the section on Windows Native Interop. This includes COM and therefore Visio. The post highlights a dotnet sample that targets Excel and so I thought I have a quick go at trying this against Visio as well.

Visio from .NET Core

I forked the dotnet/samples repository on GitHub and submitted a pull request and so now you can see the code here:

  • https://github.com/dotnet/samples/tree/main/core/extensions/VisioDemo

There's really not much to do, but the steps I went through were as follows:

  • Installed Visual Studio 2019 Preview. I think this is optional, but I wanted to try it out in any case. (2019 sits very happily along side my 2017 install and I've not had any conflicts so far.)

  • Installed .NET Core 3.0 Preview 2.0

  • Created a new project - I copied the Excel demo and opened this in Visual Studio (hence the solution file), but you could use the CLI to generate a new project. In either case you need to add the COM reference to the project file manually (by copying from a .NET Framework project) as Visual Studio doesn't support this scenario currently.

Why bother?

You might be reading this and thinking, well that's nice but...so what? Well, to start with I thought this was just an interesting itch that I'd scratch, but I can also see some scenarios where .NET Core might be useful - for example if you already have Core in your tool chain then having a Visio output (or input) as a Global tool might be really handy (don't forget you can new up an InvisibleApp as opposed to the standard one). Another area might be where you want a portable tool that can target Visio when used on a system that hosts it, but carry on with other functionality when that's not the case.

Anyway, for the moment it's nice to see that .NET Core is able to support COM interop and that Visio is part of that party.

Microsoft MVP Logo

John has been a Microsoft MVP, in the award categories of Visio and M365, since 2008.

Visio Blogs

  • Bill Morein (via Wayback Machine)
  • Chris Castillo (via Wayback Machine)
  • Chris Hopkins (via Wayback Machine)
  • David Parker
  • Eric Rockey
  • Jesse Phillips-Mead
  • John Marshall
  • Michel LAPLANE (FR)
  • Nikolay Belyh
  • Saveen Reddy (via Wayback Machine)
  • Visio Guy
  • Visio [Product] Blog
  • Visio Insights (via Wayback Machine)

Visio Resources

  • Developing Microsoft Visio Solutions
  • Visio Stencils at ShapeSource
  • Microsoft Visio YouTube Playlist
  • Visio (Product site)
  • Office 2010 Engineering
  • Visio 2016 SDK (Download)
  • Visio JavaScript API reference
  • VisioMVPs.org
Contact

visualSignals ltd
31 Riverview Grove
London, W4 3QL
United Kingdom

+44 (0) 208 078 9120

Around the Web

Copyright © visualSignals ltd 2025

Mastodon