How does VSTO work in Visual Studio 2010? - visual-studio

Few question about VSTO project I don't understand:
Registration - unlike native Office Plugin, where I've an installation project, how does the deployment work in managed add-in? After building the project, I do have the necessary entries in the registry that define the plugin (HKCU\Software\Microsoft\Office\Outlook\Addins...). Where is the code that perform this registration?
Also, why in the HKCU? I'd like the plugin to be defined for all users (in HKLM). How do I change that?
How does Visual Studio know to start Outlook, when I press F5? In the property page for the project, under the debugging tab, the 'Start Option' is set to 'Start project'. Who tells Visual Studio that starting the project means starting Outlook?
Looking for more materials about VSTO. Can you recommend a resource?

A few answers
1. Basically the same for a managed project except that the Reg entries point to the .MANIFEST file, which in turn identifies the dll of the addin assembly.
Ohhh. this is a LONG story, there's lots of info on the web about it. Google "registering an addin for all users".
Short version is that it's possible, but requires some really weird and difficult to explain registry shinanigans.
If you've created an Outlook addin property, then by virtue of that project type, VS knows what to do on start.
I've never found a good definitive source for vsto material. Google's been my best friend for that kind of info. Andrew Coates has a pretty decent list here though
http://blogs.msdn.com/b/acoat/archive/2007/08/02/vsto-resources.aspx

I have no explicit information but currently I'm working through http://msdn.microsoft.com/en-us/library/ff937654.aspx which so far has been a great source of information. Please let me know if this worked out for your Outlook project.

Related

How do I set permissions on my VSTO outlook add-in?

I am trying to distribute my Outlook Add-In to the rest of the company.
I'm using Visual Studio 2008 Professional and Outlook 2003. In VS I used an installed template for Outlook 2003. It created a solution with BOTH a project and an installer.
I use the project and created an Add-In. It works GREAT on my PC in development. Now, I want to distribute it. Here's where things go haywire. The nice little installer they provide DOESN'T ACTUALLY WORK.
The installer runs and places the files where they are to go, but the add-in doesn't run. Instead it gets errors about not having permissions. The installer didn't automatically set the security settings for you.
No problem. You just have to set those settings... right? But no where can I find a simple list of those settings.
I've been to http://msdn.microsoft.com/en-us/library/bb332051.aspx a thousand times from almost every possible link on the web. I've read every Microsoft paper that I can find on VSTO add-Ins. Unfortunately everything seems to reference some magic script... "Just include the sample code..."
[rant] IF A SECTION OF CODE OR AN ENTIRE SOLUTION IS REQUIRED TO DISTRIBUTE YOUR CODE IT IS NOT SAMPLE!! IT IS REQUIRED !!! [/rant]
There. I feel better.
Since I installed VS2008, I don't have the directory:
C:\Program Files\Microsoft Visual Studio 2005 Tools for Office SE Resources\Samples
No problem, right? Just DL it from microsoft. I've downloaded every "vstor.exe" that I can get my hands on. They all offer to "repair or uninstall" my current installation, but no matter what I choose, the vstor.exe crashes.
HELP!!!
I just want to know what I need to do (the manual steps, if necessary!!!!!) to get my friggin app distributed.
No magic "include this gizmo". No fifty-thousand page diatribes.
Anyone know how this is ACTUALLY done?!
I got it to work.
I was able to get a "sample code" update from Microsoft that allowed me to follow the walk-through.
I still think that's utterly ridiculous to HAVE to use sample code to easily distribute your app. However it is working at the moment.
The link I used was given to me by anonymous use on a different board. Whoever you are THANK YOU!!!!
Here is the link I was given:
http://www.microsoft.com/downloads/details.aspx?familyid=6991E869-8D5B-45F4-91E7-B527BD236F4C&displaylang=en
This allowed me to actually get my hands on that mysterious "sample" code even though I use VS2008 Professional.

Visual Studio 2008 Plug-in / Add-in development - Getting Started

In relation to this stackoverflow question, how would I go about creating my own Visual Studio 2008 plug-in?
I've checked the Visual Studio Developer Centre on MSDN, but the amount of info is overwhelming. There are loads of project types, and I don't even know where to start.
Where should I start looking if I want to write something which meets the following requirements:
A plug-in that runs like a "service" in Visual Studio, and is able to poll Visual Studio for information, and handle Visual Studio events.
The info I'd like to access from VS are things like, what projects are currently open, who has them open, and other solution/project file based info.
The events I'd like to be able to handle are things like, the opening/closing/editing/creating/deleting of Solutions / Projects / individual files.
I'd also like to be able to handle any interaction with VS on a per solution basis. So, I'd like to handle any interaction with files, even code editing, but also, just other interaction, like with the menus, or just the IDE itself.
As well as these, I'd also like to be able to store data somewhere. Where is this usually done? Can I add Metadata to the Solution file? Or, does it make sense to save this info to a small local instance of a database, that is somehow attached to the solution..?
I just need a push in the right direction, is any of this possible? What part of the Visual Studio Developer Centre should I focus on? What APIs should I check out?
cheers!
An add-in can do most of that. There's a template in VS2008 for creating a base add-in.
I have an add-in that you can download that hooks into the solution/project load events etc - it is free and comes with source code ( http://www.huagati.com/projectloader/download/huagatiprojectloader.zip ). This particular add-in detects when projects/solutions are loaded and pre-loads referenced assemblies to work around a CLR bug that can cause VS2008 to crash. Anyway, the source code for it shows how to detect some of the events you're looking for.
Other than that, the definitive resource on add-in development and all the little quirks and tricks involved is Carlos Quintero's blog ( http://msmvps.com/blogs/carlosq/ ) and the "howto" article series on his website ( http://www.mztools.com/resources_vsnet_addins.aspx ).
Craig Skibo's blog ( http://blogs.msdn.com/craigskibo/ ) also has some useful tips.
You want:
Visual Studio Extensibility Developer Center
VSX Forum
Visual Studio 2008 SDK
Professional Visual Studio Extensibility by Keyvan Nayyeri
Buy the book, if nothing else.

Visual Studio 6 Custom Toolbar

I have a legacy VB6 app that I still need to support. I also have a new PC and I would like to copy my custom toolbar that I created on my old PC. Does anybody know where Visual Studio 6 custom toolbars are persisted to?
Thanks
I think you are talking about an addin. Addins written in VB6 for VB6 use a reference to Microsoft Visual Basic 6.0 Extensibility. You compile the application as an ActiveX EXE and as such it can be placed anywhere on the hard drive. You can look at vbaddin.ini for the *addin.*Connect setting where addin will be the addin name. Unfortunately this is not the file name or path, but it should be close enough to help you search the the application.
I don't know where that is stored, but you could try running Process Monitor from SysInternals, and see what VB6 writes to files and the registry when you change your custom toolbar. To be honest though, it'll probably be quicker to set the toolbar up by hand.

Outlook 2003 Addons

I want to create a custom Addon/plugin for Outlook 2003, to support integrated functionality with a task management system.
I am unable to find many good development resources for the same.
Can someone please explain Outlook 2003 architecure and development of a plugin.
Good links/resources are also welcome.
Here is a tutorial on outlook architecture getting started building Outlook 2003 plugins from MSDN:
http://msdn.microsoft.com/en-us/library/aa289167.aspx
There is also a huge list of resources here: http://www.microeye.com/resources/res_tech_vsnet.htm
Good luck!
What you want can be done.
The bottom line is that you need to use Visual Studio 2005 or Visual Studio 2008 plus Visual Studio Tools for Office (VSTO) plus Outlook 2003 (of course) to build an "Adddin" for Outlook.
Addins are quite complicated to write mostly because Outlook has eccentricities that are not well documented. For example, a method Outlook.MailItem.GetHashCode() is not always the same even for the same object despite what you might expect from something as seemingly absolute as a 'HashCode' for an object. Knowing that and many other quirks of the VSTO+Outlook API are for what the professionals get paid. There are MANY quirks. If you are learning then you will need to start with the resources Gdeglin has provided.
Also look at the MSDN VSTO forum:
http://social.msdn.microsoft.com/Forums/en-US/vsto/threads <- very active!
And Outlook code: http://www.outlookcode.com/
Also here is a Google search on MSDN for various VSTO 'tips'.

How to deploy Visual Studio add-ins via ClickOnce?

Is is possible to deploy VS add-ins using ClickOnce? How can I do it?
Take a look at Securing and Deploying Add-Ins. And the subtopic Securing Add-ins by Using ClickOnce.
I haven't personally used them, but I found them while searching with a similar question as yours.
#Rob: The links you have provided is Add-in's for Applications (aka MS Office), not for Add-in's for Visual Studio (as I understand the question). The Add-in object model in Visual Studio does not support ClickOnce - unfortunately.
To deploy Add-in's for Visual Studio, visit http://msdn.microsoft.com/en-us/library/dd393694.aspx.
I'm pretty sure that you cannot do this. ClickOnce is designed for side-effect free deployments, and don't impact registry (except perhaps for file associations) or "Program Files" (having their own repository).
I'm pretty sure you'll need msi for this.

Resources