none
Migrating Visual Studio Projects across computers with different versions of office installed RRS feed

  • Question

  • Hi

    I created a word 2007 com addin using visual studio 2010 and office 2007 was installed on the computer. I want to migrate the project onto another computer (because the computer is faster) and it has office 2010.

    However when I bring the project into the other computer the conversion wizard wants to change the word addin to a 2010 (ie change the office pia reference from 12 to 14).

    I know that I can create word 2007 solutions with office 12 reference on the computer that has office 2010 installed on it.

    So what do I need to do so that visual studio does not convert my solution.

    Sunday, February 16, 2014 12:11 AM

All replies

  • Instead of adding a reference to Word from the COM tab in VS References dialog, add a reference to the Interop.Word.dll generated on the Word 2007 machine.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Sunday, February 16, 2014 12:19 AM
  • Actually there is a much simpler method. Go to Tools, Options, Select show all settings, Click Office Tools, Project Upgrade and clear the Always upgrade to installed version of Office” option. This will stop automatic conversion.

    However thanks for the reply.

    • Marked as answer by tfitzhardinge Sunday, February 16, 2014 12:55 AM
    • Unmarked as answer by tfitzhardinge Sunday, February 16, 2014 2:13 AM
    Sunday, February 16, 2014 12:55 AM
  • Sorry my solution only stopped the automatic upgrading.

    Thank you for your previous advice however if I wanted to do it the other way and instead upgrade the solution and then change it back. How do I do that.

    I tried changing the Office12 to Office14 however that was not enough to get the solution. What else do I need to change.

     
    Sunday, February 16, 2014 3:43 AM
  • So why not grab the old interop dll from the Word 2007 machine and use it on your new machine?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Sunday, February 16, 2014 3:52 AM
  • I looked into copying the interop assemblies, which you cannot do directly. Apparently you are meant to use either powershell or command prompt but do not know how to copy the assembly.
    Monday, February 17, 2014 1:20 PM
  • Why can't you do that directly? If you add Outlook from the COM tab in the References dialog, VS will generate interop.outlook.dll for you.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Monday, February 17, 2014 2:16 PM
  • I tried changing the permissions in the C:/Windows/Assembly folder however that still does not give you access to copying the assembly.

    I have tried adding the Interop & Office12 dlls (Word 2007) as COM addins into Word 2010 however I received the error message that the dlls are not Office addins.

    The only way that I have achieved to date to get the word 2007 addin to debug on Word 2010 machine is to allow VS2010 to automatically upgrade the addin.

    What steps have I missed.

    Tuesday, February 18, 2014 8:20 AM
  • Why is the dll in GAC?

    On the 2007 machine, add a reference to Word from the COM tab in the References dialog. Build your solution. Is interop dll created in the bin folder of tour solution?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Tuesday, February 18, 2014 1:50 PM
  • Hi tifitzhardinge

    I think some clarification is in order, here...

    1. You've posted in the VSTO forum. Is this a VSTO add-in, or a COM add-in? If the latter, your question needs to be moved to a different forum in order to prevent confusion.

    2. If a VSTO add-in, then you cannot use Dmitry's suggestion, which I'll explain in more detail further down.

    3. If all you need is to install and run the add-in on a 2010 computer then you shouldn't need the 2007 PIAs. The references to the 2007 PIAs will automatically "map" to the 2010 PIAs.

    4. If you need to develop the VSTO solution and retain a link to the 2007 PIAs then you should ("must") uninstall Office 2010 and install Office 2007. VSTO only operates properly when a single version of Office is installed.

    5. It's also possible, using VS 2010, to allow the solution to upgrade and then activate the option "embed interop types" (requires the solution to target .NET Framework 4.0). This will make the add-in version-independent.

    6. What Dmitri is suggesting is that you create a set of IAs and distribute them with your solution, to be used instead of the Office PIAs. In order to create an IA you need to use the .NET Framework tool tlbImport.exe. Visual Studio will usually call this automatically IF no valid set of PIAs exist for a *.tlb file. Otherwise, you need to run the tool explicitly from the command prompt.

    IAs can react differently than PIAs, which have been optimized by the software manufacturer, so you'd need to do thorough testing if you go this route.


    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, February 19, 2014 2:31 PM
    Moderator
  • Cindy thanks for the explanation.

    I created a Word 2007 addin that I believe is application level. So does that make it a COM addin?

    I am targeted the 4.0 .net framework.

    It was more exploring the idea of whether or not I could debug the word addin on both computers that had either MS Offcie 2007 or MS Office 2010. Also what was involved. It is not critical but more ideal to be able to achieve this.

    I have been able to create a visual studio deployment package that installs on Word 2007 and then if I wanted to deploy on word 2010 then I could change the deployment package to 64bit and change the component ID to word 2010.

    Thursday, February 20, 2014 6:21 AM