Надстройка Outlook не будет установлена ​​после обновления Visual Studio - PullRequest
0 голосов
/ 21 декабря 2018

У меня есть надстройка Microsoft Outlook, которая полностью работала в режиме отладки, но не работал установщик с одним щелчком мыши.

Поэтому я решил обновить Visual Studio, думая, что это может помочь.

Затем я обнаружил, что причиной, по которой я не смог установить, было повреждение в проекте надстройки, из-за которого не работала функция публикации.Решение содержит 10 проектов (смесь VB & C #) и фактический проект надстройки Outlook, который ссылается на все эти проекты.

Я создал новый проект надстройки Outlook в решении, переместил весь свой код в этот проект и удалил старый поврежденный.Когда я компилирую все правильно, нет ошибок.

Но когда я отлаживаю этот проект надстройки, он не загружается с System.BadImageFormatException.Все проекты настроены на компиляцию / сборку как «любой процессор».System.BadImageFormatException предполагает, что он пытается загрузить 32-битный код на мою 64-битную машину.Но каждый проект, настроенный на «любой процессор», не должен этого делать?Я также попытался установить каждый проект на x64, и это имеет тот же результат.Как я могу дополнительно устранить неполадки, чтобы выяснить, что на самом деле вызывает проблему?

Вот журнал из Outlook, когда он не может загрузить:

Could not create an instance of startup object DocumentOneOutlookAddin2019.ThisAddIn in assembly DocumentOneOutlookAddin2019, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8b7a688d5b244ff2.


> ************** Exception Text ************** Microsoft.VisualStudio.Tools.Applications.Runtime.CannotCreateStartupObjectException:
> Could not create an instance of startup object
> DocumentOneOutlookAddin2019.ThisAddIn in assembly
> DocumentOneOutlookAddin2019, Version=1.0.0.0, Culture=neutral,
> PublicKeyToken=8b7a688d5b244ff2. --->
> System.Reflection.TargetInvocationException: Exception has been thrown
> by the target of an invocation. ---> System.BadImageFormatException:
> Could not load file or assembly 'DocONE.ApplicationCache,
> Version=2.0.0.6, Culture=neutral, PublicKeyToken=6effde05e8b7c663' or
> one of its dependencies. An attempt was made to load a program with an
> incorrect format.    at
> DocumentOneOutlookAddin2019.ThisAddIn..ctor(Factory factory,
> IServiceProvider serviceProvider)    --- End of inner exception stack
> trace ---    at System.RuntimeMethodHandle.InvokeMethod(Object target,
> Object[] arguments, Signature sig, Boolean constructor)    at
> System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags
> invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  
> at
> Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.CreateEntryPoint(String
> entryPointTypeName)    --- End of inner exception stack trace ---   
> at
> Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.CreateEntryPoint(String
> entryPointTypeName)    at
> Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.Microsoft.VisualStudio.Tools.Office.Runtime.Interop.IExecuteCustomization2.LoadEntryPoints(IntPtr
> serviceProvider)
> 
> 
> ************** Loaded Assemblies ************** mscorlib
>     Assembly Version: 4.0.0.0
>     Win32 Version: 4.7.3221.0 built by: NET472REL1LAST_C
>     CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
> ---------------------------------------- Microsoft.VisualStudio.Tools.Office.Runtime
>     Assembly Version: 10.0.0.0
>     Win32 Version: 10.0.60301.0
>     CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Office.Runtime/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Office.Runtime.dll
> ---------------------------------------- System.Core
>     Assembly Version: 4.0.0.0
>     Win32 Version: 4.7.3221.0 built by: NET472REL1LAST_C
>     CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
> ---------------------------------------- System
>     Assembly Version: 4.0.0.0
>     Win32 Version: 4.7.3190.0 built by: NET472REL1LAST_C
>     CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
> ---------------------------------------- System.Configuration
>     Assembly Version: 4.0.0.0
>     Win32 Version: 4.7.3062.0 built by: NET472REL1
>     CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
> ---------------------------------------- System.Xml
>     Assembly Version: 4.0.0.0
>     Win32 Version: 4.7.3062.0 built by: NET472REL1
>     CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
> ---------------------------------------- System.Security
>     Assembly Version: 4.0.0.0
>     Win32 Version: 4.7.3062.0 built by: NET472REL1
>     CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Security/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Security.dll
> ---------------------------------------- Microsoft.VisualStudio.Tools.Applications.Hosting
>     Assembly Version: 10.0.0.0
>     Win32 Version: 10.0.60301.0
>     CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Hosting/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Hosting.dll
> ---------------------------------------- Microsoft.VisualStudio.Tools.Applications.Runtime
>     Assembly Version: 10.0.0.0
>     Win32 Version: 10.0.60301.0
>     CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Runtime/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Runtime.dll
> ---------------------------------------- System.Deployment
>     Assembly Version: 4.0.0.0
>     Win32 Version: 4.7.3062.0 built by: NET472REL1
>     CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Deployment/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Deployment.dll
> ---------------------------------------- Microsoft.VisualStudio.Tools.Applications.ServerDocument
>     Assembly Version: 10.0.0.0
>     Win32 Version: 10.0.60301.0
>     CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.ServerDocument/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll
> ---------------------------------------- System.Windows.Forms
>     Assembly Version: 4.0.0.0
>     Win32 Version: 4.7.3221.0 built by: NET472REL1LAST_C
>     CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
> ---------------------------------------- System.Drawing
>     Assembly Version: 4.0.0.0
>     Win32 Version: 4.7.3062.0 built by: NET472REL1
>     CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
> ---------------------------------------- System.Xml.Linq
>     Assembly Version: 4.0.0.0
>     Win32 Version: 4.7.3062.0 built by: NET472REL1
>     CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll
> ---------------------------------------- Microsoft.Office.Tools
>     Assembly Version: 10.0.0.0
>     Win32 Version: 10.0.60301.0
>     CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.dll
> ---------------------------------------- Microsoft.Office.Tools.Outlook.Implementation
>     Assembly Version: 10.0.0.0
>     Win32 Version: 10.0.60301.0
>     CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools.Outlook.Implementation/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Outlook.Implementation.dll
> ---------------------------------------- Microsoft.Office.Tools.Common.Implementation
>     Assembly Version: 10.0.0.0
>     Win32 Version: 10.0.60301.0
>     CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools.Common.Implementation/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Common.Implementation.dll
> ---------------------------------------- Microsoft.Office.Tools.Common
>     Assembly Version: 10.0.0.0
>     Win32 Version: 10.0.60301.0
>     CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools.Common/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Common.dll
> ---------------------------------------- Microsoft.Office.Tools.Outlook
>     Assembly Version: 10.0.0.0
>     Win32 Version: 10.0.60301.0
>     CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Office.Tools.Outlook/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Outlook.dll
> ---------------------------------------- DocumentOneOutlookAddin2019
>     Assembly Version: 1.0.0.0
>     Win32 Version: 1.0.0.0
>     CodeBase: file:///C:/MyWork/docone-addin/DocumentOneOutlookAddin2019/bin/Debug/DocumentOneOutlookAddin2019.DLL
> ---------------------------------------- Microsoft.Office.Tools.Outlook.v4.0.Utilities
>     Assembly Version: 10.0.0.0
>     Win32 Version: 10.0.30319.1
>     CodeBase: file:///C:/MyWork/docone-addin/DocumentOneOutlookAddin2019/bin/Debug/Microsoft.Office.Tools.Outlook.v4.0.Utilities.DLL
> ---------------------------------------- Microsoft.Office.Tools.Common.v4.0.Utilities
>     Assembly Version: 10.0.0.0
>     Win32 Version: 10.0.30319.1
>     CodeBase: file:///C:/MyWork/docone-addin/DocumentOneOutlookAddin2019/bin/Debug/Microsoft.Office.Tools.Common.v4.0.Utilities.DLL
> ----------------------------------------
> 
> ################################################################### Also I have the log from fuslogvw here:
> *** Assembly Binder Log Entry  (21/12/2018 @ 12:28:13 PM) ***
> 
> The operation failed. Bind result: hr = 0x8007000b. An attempt was
> made to load a program with an incorrect format.
> 
> Assembly manager loaded from: 
> C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under
> executable  C:\Program Files (x86)\Microsoft
> Office\Office16\outlook.exe
> --- A detailed error log follows. 
> 
> === Pre-bind state information === LOG: DisplayName = DocONE.ApplicationCache, Version=2.0.0.6, Culture=neutral,
> PublicKeyToken=6effde05e8b7c663  (Fully-specified) LOG: Appbase =
> file:///C:/MyWork/docone-addin/DocumentOneOutlookAddin2019/bin/Debug/
> LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache
> Base = NULL LOG: AppName = NULL Calling assembly :
> DocumentOneOutlookAddin2019, Version=1.0.0.0, Culture=neutral,
> PublicKeyToken=8b7a688d5b244ff2.
> === LOG: This bind starts in default load context. LOG: Using application configuration file:
> C:\MyWork\docone-addin\DocumentOneOutlookAddin2019\bin\Debug\DocumentOneOutlookAddin2019.dll.config
> LOG: Using host configuration file:  LOG: Using machine configuration
> file from
> C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
> LOG: Post-policy reference: DocONE.ApplicationCache, Version=2.0.0.6,
> Culture=neutral, PublicKeyToken=6effde05e8b7c663 LOG: GAC Lookup was
> unsuccessful. LOG: Attempting download of new URL
> file:///C:/MyWork/docone-addin/DocumentOneOutlookAddin2019/bin/Debug/DocONE.ApplicationCache.DLL.
> LOG: Assembly download was successful. Attempting setup of file:
> C:\MyWork\docone-addin\DocumentOneOutlookAddin2019\bin\Debug\DocONE.ApplicationCache.dll
> LOG: Entering download cache setup phase. LOG: Assembly Name is:
> DocONE.ApplicationCache, Version=2.0.0.6, Culture=neutral,
> PublicKeyToken=6effde05e8b7c663 ERR: Invalid assembly platform or
> ContentType in file (hr = 0x8007000b). ERR: Setup failed with hr =
> 0x8007000b. ERR: Failed to complete setup of assembly (hr =
> 0x8007000b). Probing terminated.

All projects are set to compile/build as 'any CPU'. The System.BadImageFormatException infers that it is trying to load 32bit code on my 64bit machine. But having every project set to 'any CPU' shouldn't do that should it? I have also tried setting every project to x64 and that has the same result. How can I further troubleshoot this to find out what is actually causing the problem?
...