none
VSTO for Office 2010 .Net 4.5 solution!? RRS feed

  • Question

  • Hi there!

    We're developing an Office 2010 add-in using VSTO.

    While trying to create a VS 2012 version, we hit the wall caused by the fact that some assemblies referenced by our project are compiled as .Net 4.5 assemblies. As a consequence, while using Visual Studio 2012 RTM, we are forced to target .Net 4.5 as well.

    And here comes the problem! Although we can upgrade to v4.5 all satellite assemblies, we are unable to upgrade core add-in assembly since VSTO projects for Office 2010 does not support .Net 4.5 as a target framework.

    Is there any workaround for this issue?

    Or even better - is it possible that the VSTO team produce (un)official .Net 4.5 package?

    Kind regards,


    Sasa Tomicic
    MCPD: Shpt Dev 2010, MCITP: Shpt Admin 2010, MCPD: Win Dev 4
    My blog: Share(d)Point of View
    Follow me on Twitter: @Sasa_Tomicic

    Please remember to click 'Mark as Answer' on the post that helps you or click 'Unmark as Answer' if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.


    Thursday, August 23, 2012 7:41 AM

Answers

  • Hello Sasa,

    I just posted something similar with some walkthrough of what I have tried.  One way around this that I found is to manually edit the .csproj to target .NET 4.5.  Open the .csproj in notepad and look for the following line of code:

        <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>

    Change this to the following:

        <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>

    When we did this, we could then build our solution.  However, you cannot debug it from VS.  When I build our installer(s), it would correctly install and run, just not under Visual Studio.

    Here is the thread I started that has more details -- not sure if it will always work though:

    http://social.msdn.microsoft.com/Forums/en-US/tfsworkitemtracking/thread/b9ed4748-b058-459d-bc09-ee357052c134

    ~Joe

    Thursday, August 23, 2012 8:00 PM

All replies

  • maybe try to contain in main add-in assembly only types from .net 4.0 and all 4.5 stuff move to separate assemblies and expose from them interfaces that you will invoke from main assembly?
    Thursday, August 23, 2012 8:12 AM
  • I'm affraid this is not possible since many of the UI objects are coming from the referenced 4.5 assemblies. At this point, the cost for the application redesign would be much too big.

    Sasa Tomicic
    MCPD: Shpt Dev 2010, MCITP: Shpt Admin 2010, MCPD: Win Dev 4
    My blog: Share(d)Point of View
    Follow me on Twitter: @Sasa_Tomicic

    Please remember to click 'Mark as Answer' on the post that helps you or click 'Unmark as Answer' if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.


    Thursday, August 23, 2012 8:15 AM
  • There are VSTO updates for VS 2012 that apply to Framework 4.5 in relation to Office 2013 (now in beta). You might try to get on the beta.
     
    I haven't been using VS 2012 or VSTO with 4.5 with Office 2013, I've been testing other scenarios and specifically mostly been working with Outlook 2013. However I do know this is available at least in beta.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Sasa Tomicic" <=?utf-8?B?U2FzYSBUb21pY2lj?=> wrote in message news:0a0f2d8a-bf9e-4797-ade2-0910cd369444...
    I'm affraid this is not possible since many of the UI objects are coming from the referenced 4.5 assemblies. At this point, the cost for the application redesign would be much too big.

    Sasa Tomicic
    MCPD: Shpt Dev 2010, MCITP: Shpt Admin 2010, MCPD: Win Dev 4
    My blog: Share(d)Point of View
    Follow me on Twitter: @Sasa_Tomicic

    Please remember to click 'Mark as Answer' on the post that helps you or click 'Unmark as Answer' if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.



    Ken Slovak MVP - Outlook
    Thursday, August 23, 2012 1:30 PM
  • Hi Ken,

    I already tried option with VS 2012, .Net 4.5 and Office 2013 and that should work fine.

    However, at this point I have to create Office 2010 solution with VS 2012 and use as a reference some .Net 4.5 assemblies.


    Sasa Tomicic
    MCPD: Shpt Dev 2010, MCITP: Shpt Admin 2010, MCPD: Win Dev 4
    My blog: Share(d)Point of View
    Follow me on Twitter: @Sasa_Tomicic

    Please remember to click 'Mark as Answer' on the post that helps you or click 'Unmark as Answer' if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Thursday, August 23, 2012 1:34 PM
  • Embed your 2013 PIA's, and make sure not to use any methods/properties/events that aren't in Office 2010 unless you discover at runtime that you are running on an Office 2013 installation.
     
    Be very careful of that as the Office app will crash if you use something it's not expecting, but it can be done that way.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Sasa Tomicic" <=?utf-8?B?U2FzYSBUb21pY2lj?=> wrote in message news:61141390-b623-4141-a55c-5974fd88f156...

    Hi Ken,

    I already tried option with VS 2012, .Net 4.5 and Office 2013 and that should work fine.

    However, at this point I have to create Office 2010 solution with VS 2012 and use as a reference some .Net 4.5 assemblies.


    Sasa Tomicic
    MCPD: Shpt Dev 2010, MCITP: Shpt Admin 2010, MCPD: Win Dev 4
    My blog: Share(d)Point of View
    Follow me on Twitter: @Sasa_Tomicic

    Please remember to click 'Mark as Answer' on the post that helps you or click 'Unmark as Answer' if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.


    Ken Slovak MVP - Outlook
    Thursday, August 23, 2012 1:51 PM
  • Hello Sasa,

    I just posted something similar with some walkthrough of what I have tried.  One way around this that I found is to manually edit the .csproj to target .NET 4.5.  Open the .csproj in notepad and look for the following line of code:

        <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>

    Change this to the following:

        <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>

    When we did this, we could then build our solution.  However, you cannot debug it from VS.  When I build our installer(s), it would correctly install and run, just not under Visual Studio.

    Here is the thread I started that has more details -- not sure if it will always work though:

    http://social.msdn.microsoft.com/Forums/en-US/tfsworkitemtracking/thread/b9ed4748-b058-459d-bc09-ee357052c134

    ~Joe

    Thursday, August 23, 2012 8:00 PM
  • Hi,

    I realize this is an old thread... but, for what it's worth, starting with Visual Studio 2013 Update 3 RC (released July 2, 2014), Visual Studio has de-coupled the Office version from the .NET version in the project templates (and added support for future .NET versions, like .NET 4.5.2).  So, you should now be able to mix-and-match Office versions (2010 or 2013) and .NET versions (4.0, 4.5, and up) in whatever way you want -- and hence be able to use .NET 4.5 in an Office 2010 project, no problem.

    You can get the VS 2013 Update 3 RC from http://www.visualstudio.com/news/2014-jul-2-vs.

    Hope this helps,

    - Michael


    Michael Zlatkovsky | Program Manager, Visual Studio

    • Proposed as answer by Boyko Ivanov Wednesday, July 8, 2015 9:08 AM
    Thursday, July 10, 2014 8:27 PM
    Moderator