Justin Kloos
Posts: 6
Joined: 2015-12-03
|
Hello!
I?Â?Ð?éve inherited an older project that utilizes AddinExpress that needs to be updated to .NET 4.5.2.
The project also uses AddinExpress.MAPI.
I?Â?Ð?ém receiving the following exception at runtime when attempting to access fields via AddinExpress.MAPI:
?Â?Ð?ìMixed mode assembly is built against version ?Â?Ð?èv2.0.50727′ of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.?Â?Ð?í
What would be the workaround for this?
Note that I also receive this error when moving the add-in via outlook after it's installed:
Exception Source: Shugo.FileGuardian.Outlook.Addin
Exception Type: System.IO.FileLoadException
Exception Message: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
Exception Target Site: AddInModule_AddinBeginShutdown
---- Stack Trace ----
ShugoFileGuardianOutlookAddin.AddInModule.AddInModule_AddinBeginShutdown(sender As Object, e As EventArgs)
Shugo.FileGuardian.Outlook.Addin.DLL: N 00000 (0x0) JIT
AddinExpress.MSO.ADXAddinModule.AddinExpress.MSO.IDTExtensibility2.OnBeginShutdown(custom As Array&)
Shugo.FileGuardian.Outlook.Addin.DLL: N 0064 (0x40) IL
(Outer Exception)
Application Domain: C:\Projects\Shugo\APP\FileGuardian.Outlook\Shugo.FileGuardian.Outlook.Addin\bin\x86\Release\
Assembly Codebase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/AddinExpress.MSO.2005/v4.0_10.1.4703.0__4416dd98f0861965/AddinExpress.MSO.2005.dll
Assembly Full Name: AddinExpress.MSO.2005, Version=10.1.4703.0, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 10.1.4703.0
Exception Type: AddinExpress.MSO.ADXExternalException
Exception Message: An error has occurred in the code of the add-in.
---- Stack Trace ----
I'd greatly appreciate any help you can give me! Thank you very much!! |
|
Justin Kloos
Posts: 6
Joined: 2015-12-03
|
Note that I've attempted to add <startup useLegacyV2RuntimeActivationPolicy="true" /> and various other tips I found in searches in the app.config |
|
Andrei Smolin
Add-in Express team
Posts: 18829
Joined: 2006-05-11
|
Hello Justin,
I've responded to your blog comment with this test:
AddinExpress.MAPI doesn?Â?Ð?ét support .NET 4.X. You need to replace AddinExpress.MAPI calls with equivalent calls of PropertyAccessor object. You get such an object using the PropertyAccessor property available on all Outlook item types (e.g. MailItem) as well as on some non-item classes. See https://docs.microsoft.com/en-us/office/vba/api/outlook.propertyaccessor.
Regards from Poland (CEST),
Andrei Smolin
Add-in Express Team Leader |
|
joos
Posts: 6
Joined: 2015-12-03
|
Thank you very much for your help, Andrei. I will refactor the code to use PropertyAccessor. Should I be referencing a certain Outlook dll from "Add-in Express for .NET\Redistributables\Interop Assemblies" if I wanted to support all versions of Outlook?
For instance, to get a recipient's first name, the following line was used:
AddInModule.CurrentInstance.MAPIStoreAccessor.GetProperty(m_recipient.AddressEntry, AddinExpress.MAPI.ADXMAPIPropertyTag._PR_GIVEN_NAME)
What dll would I reference to do the equivalent? Is there any chance you might have a code example? |
|
Andrei Smolin
Add-in Express team
Posts: 18829
Joined: 2006-05-11
|
|