Visio add-in project templates

Started by Nikolay, November 27, 2014, 08:47:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yacine

Thank you Nikolay,
I hadn't set "Register for COM interop".
Works fine now.
Yacine

Nikolay

#16
Quote from: Yacine on December 08, 2014, 06:08:57 AM
Thank you Nikolay,
I hadn't set "Register for COM interop".
Works fine now.

Hi Yacine, good to know!

This is a key point about the registration :)
If you set it, then on build Visual studio registers the DLL at the location where it is, thus overriding what was done in the setup.
In principle, you can set it once, and then remove (so that you can start VS without admin rights)
Or you can register it by hand:

> regasm.exe /codebase <the path to the dll in debug folder>

I think the project should be changed to have this checkbox set by default.
The issue is, you would need to start VS as admin if this checkbox is set (which I thought is bad), but this would definitely help to avoid the confusion.
Visual Studio cannot register a DLL per-user unfortunately.

About the setup - it does not uninstall the previous version, it has "product number" auto-generated now. To block this, you could replace "*" in "productid" with real guid in Product.wxs.
Also, it would be probably better to do it like this for safety by default.

Nikolay

It turned out that VSTO projects are also working just fine with Visual Studio 2013 Community Edition.
You need to just install Tools for Office:

http://blogs.msdn.com/b/visualstudio/archive/2014/03/03/announcing-office-developer-tools-for-visual-studio-2013-march-2014-update.aspx

Visio Guy

So has anybody gotten this to work with:

1. A VSTO add-in that is made up of MULTIPLE projects (ie: lots of dlls)
2. Stencils, templates and drawintgs
3. Other content files like xml files and Excel files?

I just can't get my head around it. When I try to adapt a Wix project, I cannot tell which GUIDs need to be changed to match the add-in, which names are to match the name of the add-in vs. the name of the .dlls vs. the namespace (sometimes you have spaces, sometimes you have underscores, etc.)

Chris Hopkins tried to add some advise, but the blog post is so incomplete, it doesn't help me at all--it doesn't say where the xml is supposed to go in the file, nor does it state which GUIDs need to be replaced, or what they are for.

http://blogs.msdn.com/b/chhopkin/archive/2013/07/08/wix-for-visio-add-ons-and-content-deployment.aspx

This Wix stuff is maddening, but so is ClickOnce!

For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Visio Guy

Your stuff doesn't seem to show up in Visual Studio 2015. Did Microsoft break a bunch of stuff (again)?
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Nikolay

Yep, needs to be adopted..
One needs to specify that it works for 2015 explicitly in the package.

Will try to fix this week :)

Nikolay

#21
Well, the week turned out to be a long one :)
Anyways, here is the update (published), version 1.0.4:

Update 1.0.4

- added support for Visual Studio 2015

- added support for Visio 2016

- Simplified source code (removed extra files, so that project structure is more like vanilla vs).

- Unified wizard settings. Now there is one wizard to rule it all. It allows you to add (bside the add-in itself) other Visio files/templates in the wizard itself, add license, name/description, etc.

- License support in installer (and wizard).

- Support for the built-in ribbon designer (optional)

- Support for both x86 and x64 in one installer in one MSI (one DLL compiled to "AnyCPU")

- Support per user/per machine install in one MSI (!)

- Support for project auto-harvesting. Means, DLL version is auto-harvested, COM registration auto-harvested (for COM addin type).

- Support for old Visio versions (without ribbon) is still there.

- Improved messaging and comments.

- Possibility to compile everything even witout Visio installed (COM addin only)

- Support for installer UI type selection (basic cases)

- No GUIDs anymore in the installer. All is auto-generated on build.

- Addin project is referenced from installer project using "project reference", so that msbuild variables can be used to refer to paths.

https://visualstudiogallery.msdn.microsoft.com/d73b91cf-eaf3-4d54-acb5-4a85bec3c1fe

Screenshots:




Example: instead of old stuff with a lot of xml text and guids (see here), you now can have this:


<File Source="$(var.MyAddin.TargetPath)">
  <visio:PublishAddin />
</File>


The name/description of the addin will be read from assembly attributes, the location of the DLL is termined by the project variables.

VisioDeveloper

#22
If possible can you provide a line with an example of a checkbox in Ribbon.xml?

The callback function is not being called no matter what i do.

Edit: Nevermind, figured it out

<checkBox id="MyCheckBox" getLabel="OnGetRibbonLabel" onAction="OnRibbonButtonCheckClick" getEnabled="IsRibbonCommandEnabled" />

Nikolay

#23
About the checkboxes.. In general, the easiest way to go with ribbon designer, not XML. Probably it should be made default in the template in case of VSTO...
I think I need to change the default in the template. Microsoft did a good job of making things simple (see the screenshot below) :)

In case you go with ribbon designer, you just dorp a checkbox from the toolbox, double-click it, and you are done!

Means, don't go with XML unless your really must. A checkbox is definitely not a reason for xml.
The possible reasons I can think of are enabling/disabling or hiding/showing controls dynamically based on current selection for example, or providing dyanmic or icons for the controls.

Anyways, with the XML - you are correct, <checkBox> should do. The thing is, in the template ribbon handlers are in the AddinUI class (not "ThisAddIn")
They redirect to ThisAddIn class.

Nikolay

Updated to version 1.0.7:

- New: improved support for non-english locales. Now you can select language of the installer in the wizard. Rrequired, if want to produce installer in non-english language, or if you use non-english symbols for your stencil/template file names, like symbols with umlauts, like "è é ê ë" or cyrilic symbols like "абвгд".

- New: added "manufacturer" field in the wizard (to be shown on install/uninstall)


Nikolay

Updated project template to v 1.1.0:

- Added support for Visual Studio 2017 (this one appeared to be pretty tough :)) )
- Fix wizard for high-DPI (4k / "retina") monitors.
- Some Visio 2007 - related fixes in the installer.