This project has moved. For the latest updates, please go here.

"Please call NetOffice.Factory.Initialize()" while interact with Visio

Mar 6, 2013 at 4:11 PM
Edited Mar 6, 2013 at 4:14 PM
Hi guys,

I'm trying to glue some code together interacting with Visio. (.NET 4.0/Visio 2010/NetOffice v1.5.1.2)

Please see the basic code below. What happens is, that I see Visio beeing started, and also closed at the end. But for whatever reason - I'll get an "Please call NetOffice.Factory.Initialize()" NetOfficeException when trying to open/create any Document.

Any ideas what goes wrong here?
using System;
using System.Collections.Generic;
using System.Text;
using NetOffice;
using Visio = NetOffice.VisioApi;
using NetOffice.VisioApi.Enums;

namespace TestApp {
    class Program {
        static void Main(string[] args) {

            Visio.IVApplication app = new Visio.Application();
            try {
                // all of the commands below fail 
                Visio.IVDocument doc = app.Documents.Add("");
                //Visio.IVDocument doc = app.Documents.Add("C:\\New.vsd");
                //Visio.IVDocument doc = app.Documents.Open("C:\\Test.vsd");
            } catch (Exception e) {
Mar 6, 2013 at 4:55 PM
I managed to sort it out... Actually all the information is there... Just some more digging required.

From what I currently understand the "current release download package" does not support Visio due to the "keytoken bug" that has already been fixed. (95603)
When I download the latest source code and link against the DLLs provided there, all works fine (no more errors)

I would be great if you could include the fix already in the main download packages and e.g. go up to v1.5.1.3, so no more people are forced to stumble across this ;)

Anyhow thanks for your great work!