none
VSTO Add-In developed under .NET 3.5 not running with .NET 4.0 (Outlook 2010, VSTO 2010) RRS feed

  • Question

  • Hi,


    we are developing an Outlook addin with VSTO 2010. During development we are targetting .NET Framework 3.5.

    On a Win7 with only .NET 4.0 installed we get an "The common language runtime could not be loaded." error.

    I searched the internet and found different statements:

    Here they say that only the exact version of the .Net Framework is possible (http://msdn.microsoft.com/en-us/library/6s0wczt9(v=vs.100).aspx)

    Here they state the same version or later (http://msdn.microsoft.com/en-us/library/6s0wczt9(VS.80).aspx)

    I saw in some threads that from .net 4 on it is possible to have different .net versions and run the addin with these versions but not with .net 2.0/3.5 and lower.

    So is it correct that if we develop for .Net 3.5 the client where it will be deployed also needs .Net 3.5 installed or is it also possible to have only .Net 4.

    Thank you.


    Regards Mark


    • Edited by Wompi Wednesday, April 16, 2014 3:22 PM
    Wednesday, April 16, 2014 3:19 PM

Answers

  • If you target Framework 3.5 that's what has to be on the computer. Framework 4 ins't compatible.

    I'd use Framework 4 in any case. It allows you to embed the PIAs so you don't have to have them installed or deploy them.


    Ken Slovak MVP - Outlook

    Wednesday, April 16, 2014 4:07 PM
  • Hello Mark,

    From Outlook point of view, it doesn't matter what .Net framework is used as the target. You just have to install the corresponding version on the PC.

    .Net framework 3.5 is build on top of CLR 2.0. But .Net framework 4.0 uses the newer CLR (Common Language Runtime). That's why you have to install it separately and can't rely on the newest framework which is already installed.

    As Ken noticed, .Net framework introduced some great features for add-in developers. One of them is the "NoPIA" feature (also called Type Embedding, but "NoPIA" just sounds cooler). With NoPIA, the necessary information to support COM interoperability is embedded into your compiled .NET code. Not only does that reduce the number of components to be distributed, only the parts of the PIA actually required by your application are incorporated into your code. If you only use a small part of a big COM object you could see significant size reductions in your compiled code.

    Wednesday, April 16, 2014 5:15 PM

All replies

  • If you target Framework 3.5 that's what has to be on the computer. Framework 4 ins't compatible.

    I'd use Framework 4 in any case. It allows you to embed the PIAs so you don't have to have them installed or deploy them.


    Ken Slovak MVP - Outlook

    Wednesday, April 16, 2014 4:07 PM
  • Hello Mark,

    From Outlook point of view, it doesn't matter what .Net framework is used as the target. You just have to install the corresponding version on the PC.

    .Net framework 3.5 is build on top of CLR 2.0. But .Net framework 4.0 uses the newer CLR (Common Language Runtime). That's why you have to install it separately and can't rely on the newest framework which is already installed.

    As Ken noticed, .Net framework introduced some great features for add-in developers. One of them is the "NoPIA" feature (also called Type Embedding, but "NoPIA" just sounds cooler). With NoPIA, the necessary information to support COM interoperability is embedded into your compiled .NET code. Not only does that reduce the number of components to be distributed, only the parts of the PIA actually required by your application are incorporated into your code. If you only use a small part of a big COM object you could see significant size reductions in your compiled code.

    Wednesday, April 16, 2014 5:15 PM
  • Hi,

    many thanks to both of you. This explains everything.


    Regards Mark

    Thursday, April 17, 2014 7:06 AM