Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy C# code and VBA scripts in one VSTO Word addin

Underlying problem I was trying to solve is to apply custom key bindings for internal VSTO Word addin methods (develiped in C#):

Globals.ThisAddIn.Application.KeyBindings.Add(  
    Word.WdKeyCategory.wdKeyCategoryCommand,  
    "MyMethodName",  
    myKey,
    ref _missing,  
    ref _missing);

Well, the problem is that this code always throws an exception because (Microsoft MSDN): “there's no way (in the object model or Word application) to bind to anything but VBA macros”.

What other developers are trying to do is to implement a workaround with VBA method that assign key bindings to VBA callbacks when addin loads, and call C# addin from those callbacks in turn. (see how to call VBA from C# for details)

This idea has a chance for live: .NET AddIn and VBA-enabled Word template. But in my project I need to deliver this addin in a single Click Once package to end-user machines (inside a corporate network where security settings are not an issue).

So the Question is: how to make a mix of C# Add-In (Ribbon) and VBA scripts in one deployment package?

Does anyone has such experience to share?

like image 745
Eugene Y. Avatar asked Feb 17 '10 21:02

Eugene Y.


People also ask

What is deployment in C#?

Framework-dependent deployment. Deploying a framework-dependent deployment with no third-party dependencies simply involves building, testing, and publishing the app. A simple example written in C# illustrates the process. Create the project. Select File > New > Project.

What is deploy solution in Visual Studio?

When you deploy a project or solution in Visual Studio, the assemblies are automatically built and deployed into the specified application.

How do I set deployment properties in Visual Studio?

In Visual Studio Solution Explorer right-click a project for which you want to configure properties, and then click Properties. Click the Deployment tab in Project Designer. Configure project properties as described in the following table, and then click OK. Repeat steps 1, 2, and 3 for each project in the solution.


1 Answers

And here we go!

Walkthrough: Deploying Multiple Office Solutions in a Single ClickOnce Installer for the .NET Framework 3.5.

A lot of hand work. But the idea is to update ClickOnce package with additional dependencies (edit manifest XML). Standard ClickOnce setup program will do the rest for you.

like image 175
Eugene Y. Avatar answered Oct 13 '22 00:10

Eugene Y.