Answered VSTO Deployment with a in-production Web Application

  • Friday, October 23, 2009 3:50 PM
     
     
    I have a pretty large DotNetNuke based custom web solution deployed on a client intranet. I am now enhancing the solution to provide some features that require VSTO. Many people here might be aware that DotNetNuke (DNN) module installation/upgrades are handled by DNN itself through its own native Private Assembly installation routines.

    I am enumerating here the current status of the server installation, and the steps I intend to take for upgrading it to support VSTO. Please correct me if I am wrong somewhere, or if this can be done in a better way.

    The server currently has .NET 3.5 SP1 installed with IIS 6.1. It also has Office 2007 installed already. However, I am not aware of the selected Office components installed on the server, as I did not install Office myself.

    I am in the process of developing the VSTO application. Its primary dependency is only on Microsoft.Office.Interop.Word.dll, obviously the Office 12 version.

    I read on this article , that complete Office installation with .NET 3.5 already installed eliminates the need for PIA installation separately. However, I did not had the chance to verify the Office installation status on server as of now.

    Now my intended steps are as follows:
    1) Verify Office 2007 PIAs are not already installed by checking Office installation status or the GAC. If they are installed, skip to step 3).
    2) Install Redistributable Primary Interop Assemblies downloaded from here if not installed already.
    3) Update website's web.config to reference desired PIAs in GAC.
    4) Install the DNN module that depends upon VSTO.

    If I have missed something, or there is a better approach, I would be obliged if someone outlines that better one. Please note that I have NOT created a VSTO Office project or an Add-in.
    I am just referencing Microsoft.Office.Interop.Word.dll from one of my assemblies to access VSTO features from a regular .NET library project.
    This page mentions Visual Studio Tools for Office Runtime also needs to be installed for running Visual Studio Tools for Office solution. However, I have not created a "Visual Studio Tools for Office solution" in strict terms. That's just a library project. Please correct me if I am wrong.

All Replies

  • Monday, October 26, 2009 4:45 AM
    Moderator
     
     Answered Has Code
    Hi Rahul,

    <<Please note that I have NOT created a VSTO Office project or an Add-in. I am just referencing Microsoft.Office.Interop.Word.dll from one of my assemblies to access VSTO features from a regular .NET library project.>>
    Here I think that you are not prepared to create a VSTO project by using templates on New->Project->Visual C#/Visual Basic->Office->2007, and just want to using word object model in your project. If yes, we need to add a reference named "Microsoft Word 12.0 Object Library" on COM tab, and add references as needed. VSTO runtime is essential part of VSTO solution. So here, it is not necessary for this scenario. You could write code to access the new word or existing word documents like this:

                using Word = Microsoft.Office.Interop.Word;
                using System.Runtime.InteropServices;
                ......
                Word.Application wordApp = new Word.Application();
                wordApp.Visible = true;
                object missing=Type.Missing;
                wordApp.Documents.Add(ref missing, ref missing, ref missing, ref missing);
                ......
                (wordApp as Word._Application).Quit(ref missing, ref missing, ref missing);
                Marshal.ReleaseComObject(wordApp);
    To open a existing word document, please refer to this page: Documents.Open Method.

    In additional, the office 2007 system install office 2007 PIA by default. As far as I know, the steps listed above about Office are basically needed. About step 3 and step 4, since I am not familiar with DNN, I am not able to give you some suggestion here. Useful link:

    If I have mistaken this scenario, please feel free to point me out.  

    Best regards,
    Bessie
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.