1

Good Afternoon Stack Exchange,

I am trying to Publish my Outlook 2013 Add-In for other people to use. I have installed my addin on my computer and to begin with when I clicked a ribbon button no window would load but it did in debug mode. For some reason now it seems to work fine on my PC however when installing it on several other peoples computers it installs and the ribbon is visible however when a ribbon button is clicked nothing happens (a window is meant to open).

I decided to download "AddInSpy" and take a look at my app on both my computer and other peoples computers. All display the same error about my addin:

Add-in DLL path is not found. System.BadImageFormatException: Could not load file or assembly 'file:///C:\Users\Alexander Harvey\Desktop\Addin\Application Files\De_Facto_Addin_1_0_0_12\De_Facto_Addin.dll.deploy' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
File name: 'file:///C:\Users\Alexander Harvey\Desktop\Addin\Application Files\De_Facto_Addin_1_0_0_12\De_Facto_Addin.dll.deploy'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.ReflectionOnlyLoadFrom(String assemblyFile)
   at AddInSpy.AssemblyScanner.GetAssemblyInfo(String fileName, String hostName, Boolean isVstoAddIn)

I am completely stuck on this and have been trying to find a fix for 3 hours. So any help would be appreciated. Thankyou.

LiveKarma
  • 221
  • 2
  • 13
  • How did you install your AddIn? Using ClickOnce? MSI installer? I would also suspect of x64/x86 compatibility. – etaiso Oct 23 '13 at 12:57
  • @etaiso ClickOne using AnyCPU Build Configuration – LiveKarma Oct 23 '13 at 13:39
  • 1
    As far as I know AnyCPU won't help you since TargetPlatform can only be set to x86/x64. For more information look in here: http://stackoverflow.com/questions/753412/setup-targeting-both-x86-and-x64 – etaiso Oct 23 '13 at 14:08

1 Answers1

1

You should try to use logging. This means you will be able to pin-point your issue.

I recommend using Log4Net and and adding a log output on every line at startup.

I had a similar issue to you and this is how I solved it, was just a silly spelling mistake in the end :P

Alex
  • 1,052
  • 7
  • 19
  • 1
    When the window is meant to load at the same time the app also saves the MailItem to a folder. My saveas line was this: `mail.SaveAs(@"C:\test\message.msg);` This caused the application to fail on other users computers because it did not have the rights to create the test folder or it didnt exist. I created the folder for them and everything worked fine. I am now using a temp folder. **What I dont understand is why was this simple problem giving BadImageFormatException error?** – LiveKarma Nov 06 '13 at 17:03
  • how to use this logger? Which file should use the logger? – rank1 May 19 '14 at 14:23
  • @rank1 Check this guide out on how to use Log4Net. Hope this helps to get you started: http://www.codeproject.com/Articles/14819/How-to-use-log-net – Alex Jul 02 '14 at 08:57