Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The answer to the question in your title is 'yes'. The .NET runtime version 2.0 (which is the runtime version used by the .NET Framework 2.0, 3.0 and 3.5) can run side-by side in a process with the .NET runtime version 4.0 (which is the version number that will also be used by the upgraded .NET Framework 4.5).</p> <p>However, the VSTO case is not so simple, since there is interaction between Excel and the VSTO runtime to decide what to load. VSTO 4 basically includes separate versions of the Office extensions targeting .NET 3.5 (under the .NET 2.0 runtime) and .NET 4.0. Depending on which version of the VSTO 4 office extensions you target, you uses classes (compatible with older VSTO) or mainly interfaces, so the VSTO API design and your code is a bit different too, depending on which version of the VSTO 4 office extensions you use. Then deployment and loading of your VSTO add-in depends on which version of the VSTO Office extensions you target.</p> <p>So the version of the .NET runtime that your VSTO 4 add-in loads in is linked to how you made the add-in. Read more here: <a href="http://msdn.microsoft.com/en-us/library/bb608603(v=vs.100).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/bb608603(v=vs.100).aspx</a> and <a href="http://msdn.microsoft.com/en-us/library/ee712596.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ee712596.aspx</a>.</p> <p>If you have other COM components, it could be that the COM components are activated in a different version of the runtime (say in the 2.0 runtime) and are then not accessible from the 4.0-runtime based add-in. The way COM interop type changed in .NET 4.0 would typically make things work <em>better</em>, since the runtime now correctly identifies types defined from different assemblies as 'the same' based on GUIDs etc. </p> <p>To make life easier, I can also suggest <a href="http://exceldna.codeplex.com" rel="nofollow">Excel-DNA</a> (which I develop). It is a free and easy add-in library for making full-featured Excel add-ins in .NET, without using VSTO. Excel-DNA allows you to target any version of Excel, and any 2.0+ version of .NET.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. COOn the penultimate paragraph - I have things in this addin where in one assembly there's, class Command with c-tor Command(MSExcel.Application app). Then I have in my addin assembly class ConcreteCommand, c-tor ConcreteCommand(MSExcel.Application app) : base(app). I thought that you needed a PIA prior to .NET 4.0 to allow these two components to share a definition of MSExcel.Application. I thought the components were not showing up because in .NET 4.0 the PIA is not looked at, and so the two assemblies may disagree on what MSExcel.Application even i
      singulars
    2. COcontinued... the two assemblies may disagree on what MSExcel.Application is, I thought this was what the PIA did - it gave a common definition of a COM type to all communicating assemblies. Is this a flawed understanding? It might be because I have (thanks to legacy of deisgn) embedded interop types as generic type parameters in this addin crossing the assemblies, which won't even compile against .NET 4.0.
      singulars
    3. COIn .NET 4 if you don't pick 'Embed Interop Types' the PIA will be used as in .NET 3.5 (there is only one MSExcel.Application type around). If you compiled a library to target .NET 3.5 with a reference to the PIA, and then loaded the library into the .NET 4 add-in which has the embedded interop types, the referenced PIA will also be loaded but the .NET 4 runtime will be smart enough to realise that the types are 'the same'.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload