none
Problems with publishing VSTO + Word document RRS feed

  • Question

  • Hello, in Visual Studio 2012, I have a Word document project (VSTO). When I run it from VS, I programmically hide 120 bookmarks and replace them with checkboxes.  I also have a button at the bottom of the form with a particular caption.  When I run "code analysis" from solution explorer, I get the message "No code analysis issues were detected."

    However, when I publish the project to another folder on my own computer, and double-click the published Word document, I still see 120 bookmarks, and zero checkboxes.  Also, the button has no caption. 

    If I double-click on the VSTO Deployment Manifest file, I get this error message: "The value of the property 'type' cannot be parsed. The error is Could not load file or assembly 'Microsoft.Office.BusinessApplications.Fba, Version=14.0.0.0, Culture=neutral, PublicKeyToken = 71e9bce111e9429c' or one of its dependencies.  The system cannot find the file specified. (c:\Program Files\Common Files\Microsoft Shared\VSTO\10.0\VSTOInstaller.exe.COnfig line 10)."

    Does anyone have a suggestion in how I can open the published Word document and have it perform the same functionality that it does from Visual Studio?  I'm confused about how to troubleshoot this.  Also, does anyone have thoughts about the message that the VSTO Deployment Manifest file is sending?

    Thanks!
    Wednesday, September 23, 2015 7:37 PM

Answers

  • Well, I finally got the published version to work!  I think Microsoft needs to work on its documentation regarding VSTO deployments. Here is what I did:

    1. In the Project/Publish section, click on the "Prerequisites" button.  After reviewing my target .NET framework, I chose "Microsoft .NET Framework 4.5 (x86 and x64)."  I also checked "Microsoft Visual Studio 2010 Tools for Office Runtime (x86 and x64)."  Lastly, I checked "Windows Installer 4.5."

    2. I published the solution to a trusted folder. However, I don't think the latter point matters because I moved it elsewhere.

    3. I copied the Application Files and folder of my project to a different location.  However, I moved the VSTO Deployment Manifest to a folder above the folder named "Application Files".

    4. I went into Control panel and uninstalled the already-existing VSTO add-in with the same name as my project.

    5. Double-clicked on the VSTO Deployment Manifest.  This time it finally worked.

    6. Open up the published Word document and it finally has the customizations that I have added in the project.

    Hooray!

    • Marked as answer by ScottMDGov Tuesday, September 29, 2015 2:58 PM
    Tuesday, September 29, 2015 2:58 PM

All replies

  • Hello Scott,

    Make sure you did all the steps described in the Deploying an Office Solution by Using ClickOnce article in MSDN.

    Wednesday, September 23, 2015 10:17 PM
  • Eugene, thanks for the reply.  I went through the steps described on that page.  I am getting the same result.

    The only option I changed was #9 under "Publish the Solution."  I have now checked the  "Visual Studio 2010 Tools for Office Runtime check box."  I continued to read through the page until I reached "Decide how you want to grant trust to the solution," where I stopped.  I don't think any of the rest applies to me.  (I am the developer and I am trying to open the published file myself.)

    When I try to open the published form, it still does not have the checkboxes that I am creating dynamically.  Also, it does not hide the bookmarks.  (I am placing the checkboxes where the bookmarks are and then hiding the bookmarks.  In my first post I said I was "replacing" the bookmarks with the checkboxes, which isn't precisely the same thing.)

    Not only are the checkboxes not being created, but the button I inserted does not have a caption.

    Is there a way to troubleshoot the published Word document?  Thanks.

    Thursday, September 24, 2015 1:07 PM
  • I wrapped the code within the ThisDocument_startup method into a "try/catch" block, which creates a log file when an error is encountered.  The published version of the Word form does not create a log.  So, apparently the published form is not executing the VSTO code, for whatever reason.

    Thursday, September 24, 2015 2:35 PM
  • You could try to rename the VSTOInstaller.exe.Config as VSTOInstaller.exe.Config.back to see the issue is resolve.
    Here is an helpful thread:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/c26d3f76-be37-4e1b-9d9a-84edae351e18/problem-with-vstoinstallerconfig

    >>>I wrapped the code within the ThisDocument_startup method into a "try/catch" block, which creates a log file when an error is encountered.  The published version of the Word form does not create a log.  So, apparently the published form is not executing the VSTO code, for whatever reason.<<<

    The Startup event is raised for each of the host items (document, workbook or worksheet) after the document is running and all the initialization code in the assembly has been run.  It is the last thing to run in the constructor of the class that your code is running in.

    Tuesday, September 29, 2015 9:41 AM
  • Well, I finally got the published version to work!  I think Microsoft needs to work on its documentation regarding VSTO deployments. Here is what I did:

    1. In the Project/Publish section, click on the "Prerequisites" button.  After reviewing my target .NET framework, I chose "Microsoft .NET Framework 4.5 (x86 and x64)."  I also checked "Microsoft Visual Studio 2010 Tools for Office Runtime (x86 and x64)."  Lastly, I checked "Windows Installer 4.5."

    2. I published the solution to a trusted folder. However, I don't think the latter point matters because I moved it elsewhere.

    3. I copied the Application Files and folder of my project to a different location.  However, I moved the VSTO Deployment Manifest to a folder above the folder named "Application Files".

    4. I went into Control panel and uninstalled the already-existing VSTO add-in with the same name as my project.

    5. Double-clicked on the VSTO Deployment Manifest.  This time it finally worked.

    6. Open up the published Word document and it finally has the customizations that I have added in the project.

    Hooray!

    • Marked as answer by ScottMDGov Tuesday, September 29, 2015 2:58 PM
    Tuesday, September 29, 2015 2:58 PM