none
Office Add-Ins using both CLR4/CLR2 Components RRS feed

  • Question

  • We have an existing Office add-in built on .NET 3.5 (SP1) that we are migrating to .NET 4.5.2 that will also support Office (64-bit).  We use a WinForms component from TX Text Control that is built on CLR2.  Their control should and does work on .NET 4.x applications but when we use it in the Office context, we were getting error.

    When we added the following to the winword.exe.config and outlook.exe.config (C:\Program Files\Microsoft Office\Office15), the add-in worked OK.

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" />
    </startup>
    </configuration>

    My concern/questions are:

    • Should we adding or modifying this file (*.exe.config) in the Microsoft Office directory?  Is this something that third-parties are expected to do?
    • Is there a way to modify this file (*.exe.config) that does not affect other applications?
    • Do we need to be worried about conflicts with other add-ons from other companies that users could be using?
    • Is there a way to scope the useLegacyV2RuntimeActivationPolicy="true" tag to just our add-on or just one component?Why do we have this issue if we are compiling everything to CLR4 even though we are using a CLR2 component that works under CLR4?

    Thanks

    Scott

    Tuesday, March 31, 2015 5:08 PM

Answers

  • Hello Scott,

    There is no need to post your message on multiple forums.

    There are two ways to go:

    1. Edit the Office application *.exe.config file. This is a workaround if you can't or don't want to rebuild controls/components against a new CLR version.

    2. Rebuild controls against the new CLR version - 4.0.

    As you understand it is better to choose #2 way.

    Here is the answers:

    Should we adding or modifying this file (*.exe.config) in the Microsoft Office directory?  Is this something that third-parties are expected to do?

    Nope. You can edit it programmatically. But typically you shouldn't do so because it affects other add-ins as well.

    Is there a way to modify this file (*.exe.config) that does not affect other applications?

    Nope, because you develop an add-in, not a standalone application. All add-ins will be affected.

    Do we need to be worried about conflicts with other add-ons from other companies that users could be using?

    Nobody can be sure that other add-ins are well-writer doesn't contains bugs :)

    Is there a way to scope the useLegacyV2RuntimeActivationPolicy="true" tag to just our add-on or just one component?Why do we have this issue if we are compiling everything to CLR4 even though we are using a CLR2 component that works under CLR4?

    No, there is no way because add-ins are not standalone applications. 

    Tuesday, March 31, 2015 5:31 PM

All replies

  • We have an existing Office add-in built on .NET 3.5 (SP1) that we are migrating to .NET 4.5.2 that will also support Office (64-bit).  We use a WinForms component from TX Text Control that is built on CLR2.  Their control should and does work on .NET 4.x applications but when we use it in the Office context, we were getting error.

    When we added the following to the winword.exe.config and outlook.exe.config (C:\Program Files\Microsoft Office\Office15), the add-in worked OK.

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" />
    </startup>
    </configuration>

    My concern/questions are:

    • Should we adding or modifying this file (*.exe.config) in the Microsoft Office directory?  Is this something that third-parties are expected to do?
    • Is there a way to modify this file (*.exe.config) that does not affect other applications?
    • Do we need to be worried about conflicts with other add-ons from other companies that users could be using?
    • Is there a way to scope the useLegacyV2RuntimeActivationPolicy="true" tag to just our add-on or just one component?
    • Why do we have this issue if we are compiling everything to CLR4 even though we are using a CLR2 component that works under CLR4?

    Thanks

    Scott

    Tuesday, March 31, 2015 5:05 PM
  • Hello Scott,

    There is no need to post your message on multiple forums.

    There are two ways to go:

    1. Edit the Office application *.exe.config file. This is a workaround if you can't or don't want to rebuild controls/components against a new CLR version.

    2. Rebuild controls against the new CLR version - 4.0.

    As you understand it is better to choose #2 way.

    Here is the answers:

    Should we adding or modifying this file (*.exe.config) in the Microsoft Office directory?  Is this something that third-parties are expected to do?

    Nope. You can edit it programmatically. But typically you shouldn't do so because it affects other add-ins as well.

    Is there a way to modify this file (*.exe.config) that does not affect other applications?

    Nope, because you develop an add-in, not a standalone application. All add-ins will be affected.

    Do we need to be worried about conflicts with other add-ons from other companies that users could be using?

    Nobody can be sure that other add-ins are well-writer doesn't contains bugs :)

    Is there a way to scope the useLegacyV2RuntimeActivationPolicy="true" tag to just our add-on or just one component?Why do we have this issue if we are compiling everything to CLR4 even though we are using a CLR2 component that works under CLR4?

    No, there is no way because add-ins are not standalone applications. 

    Tuesday, March 31, 2015 5:31 PM
  • See Office Add-Ins using both CLR4/CLR2 Components. Don't post duplicates on the forums.
    Tuesday, March 31, 2015 5:32 PM