Problem in "Visio add-in or add-on" wizard

M

Microsoft

The code generated by the C# version of the "Visio add-in or add-on" wizard
that comes with the new Visio 2003 SDK does not compile! (At least not when
generating a COM add-in).

I've seen this problem on 2 different machines. To reproduce, simply use
the C# version of the wizard (found in the "Visual C# Projects" Project
Types folder, not in the "Other Projects\Extensibility Projects" folder,
where the standard "Shared Add-in" wizard is found) to generate a Visio COM
add-in, and then try to build the result. (I also asked to have the add-in
run whenever Visio starts, but I doubt that has any bearing on this
problem).

The problem is caused by the fact that the Visio interop assembly's
namespace is now just "Visio" instead of "Microsoft.Office.Interop.Visio",
as it was in the past (why the change?). The generated code is still using
the old namespace.

Fixing this allows the generated code to compile. Probably the best way to
fix this is to remove the "using Microsoft.Office.Interop.Visio" directives,
and just use the Visio namespace directly wherever necessary (e.g.,
"Visio.Application" instead of just "Application"). That helps to avoid any
name clashes (e.g., if you happen to have another "Application" class, as
when your COM add-in needs to support multiple Office apps).

Will the wiazrd be patched to fix this problem?
 
M

Mai-lan [MS]

Hi, there: I'm not able to repro the problem. Does anyone else on the
newsgroups run into this problem?

Thanks,
Mai-lan
Microsoft Corporation
 
A

Alex [MSFT]

The problem you're experiencing is consistent with VS.NET's behavior when
the Visio 2003 is not the currently registered Visio object...this would
typically happen on a machine that has multiple versions of Visio installed,
and one of the older versions was run most recently. Running Visio 2003
directly before running VS.NET and the Visio wizards should result in VS.NET
referencing the proper Visio and therefore using the PIA instead of a
generated interop.

Alex
 
S

Steve

That doesn't seem to help. Neither of the C# samples in the Visio 2003 SDK will compile. They all seem to get errors like

The type or namespace name 'Visio' does not exist in the class or namespace 'Microsoft.Office.Interop' (are you missing an assembly reference?

Office Plan is even worse, complaining about all sorts others

I've tried deleting and re-adding the references, but that doesn't help.

In addition, Lesson 1 of the Managed Code Interop Tutorial says the following, but I can never get the visio pia to come from the GAC

In the Properties window, note that the Path property lists Microsoft.Office.Interop.Visio in the c:\WINDOWS\assembly\GAC\ path. This indicates that the Visio PIA is being used instead of forcing Visual Studio .NET to create its own COM interop assembly in your project's location. With a typical Visio installation, if the .Net Framework version 1.1 is installed on your computer, the Visio PIA is installed in the global assembly cache (GAC). If you installed the .Net Framework after you installed Visio, you will need to run the Visio setup again to install the PIA.


----- Alex [MSFT] wrote: ----

The problem you're experiencing is consistent with VS.NET's behavior whe
the Visio 2003 is not the currently registered Visio object...this woul
typically happen on a machine that has multiple versions of Visio installed
and one of the older versions was run most recently. Running Visio 200
directly before running VS.NET and the Visio wizards should result in VS.NE
referencing the proper Visio and therefore using the PIA instead of
generated interop

Ale
 
A

Al Edlund

I had similar problems. The help facility said to run REGASM from inside of
VS.NET and of course that wouldn't work. I ended up opening a DOS command
window, changing to the directory that REGASM lives in and then calling the
Visio PIA registration from there. Just one of the reasons why I ended up
abandoning VS.NET again.
Al
Steve said:
That doesn't seem to help. Neither of the C# samples in the Visio 2003
SDK will compile. They all seem to get errors like:
The type or namespace name 'Visio' does not exist in the class or
namespace 'Microsoft.Office.Interop' (are you missing an assembly
reference?)
Office Plan is even worse, complaining about all sorts others.

I've tried deleting and re-adding the references, but that doesn't help.

In addition, Lesson 1 of the Managed Code Interop Tutorial says the
following, but I can never get the visio pia to come from the GAC:
In the Properties window, note that the Path property lists
Microsoft.Office.Interop.Visio in the c:\WINDOWS\assembly\GAC\ path. This
indicates that the Visio PIA is being used instead of forcing Visual Studio
..NET to create its own COM interop assembly in your project's location. With
a typical Visio installation, if the .Net Framework version 1.1 is installed
on your computer, the Visio PIA is installed in the global assembly cache
(GAC). If you installed the .Net Framework after you installed Visio, you
will need to run the Visio setup again to install the PIA.
----- Alex [MSFT] wrote: -----

The problem you're experiencing is consistent with VS.NET's behavior when
the Visio 2003 is not the currently registered Visio object...this would
typically happen on a machine that has multiple versions of Visio installed,
and one of the older versions was run most recently. Running Visio 2003
directly before running VS.NET and the Visio wizards should result in VS.NET
referencing the proper Visio and therefore using the PIA instead of a
generated interop.

Alex


Microsoft said:
The code generated by the C# version of the "Visio add-in or
add-on"
wizard
that comes with the new Visio 2003 SDK does not compile! (At least
not
when
generating a COM add-in). simply use
the C# version of the wizard (found in the "Visual C# Projects" Project
Types folder, not in the "Other Projects\Extensibility Projects" folder,
where the standard "Shared Add-in" wizard is found) to generate a
Visio
COM
add-in, and then try to build the result. (I also asked to have
the
add-in
run whenever Visio starts, but I doubt that has any bearing on this
problem). assembly's
namespace is now just "Visio" instead of "Microsoft.Office.Interop.Visio",
as it was in the past (why the change?). The generated code is
still
using
the old namespace.
best way
to
fix this is to remove the "using Microsoft.Office.Interop.Visio" directives,
and just use the Visio namespace directly wherever necessary (e.g.,
"Visio.Application" instead of just "Application"). That helps to
avoid
any
name clashes (e.g., if you happen to have another "Application" class, as
when your COM add-in needs to support multiple Office apps).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top