none
Cannot open VSTO 2005/Excel 2003 customization files after migrated to VSTO2010 RRS feed

  • Question

  • I have a Excel Document level customization project that was build using VSTO 2005 that uses Excel 2003 template (xlt). Now I have migrated to VS2010 (.NET4) and Excel 2007 environment.

    My application is a reporting tool that users can create Excel reports using the customization. So currently they have number of existing *.xls and *.xlsx reports.

    My problem is after I have migrated my solution to VSTO2010, I cannot open previously created reports. It givesthe error,

    Could not load file or assembly 'MyApp.BusinessAnalytics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff90f512e10aef0d' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

    I am using MSI in order to install the application.

    In previous (2005) version I have used a ServerDocument class to attach the assembly as below,

            AppManifest appManifest = serverDocument.AppManifest;
            string assemblyPath = Path.Combine("%" + UpdateApplicationManifest.MyExcelAnalyzerHome + "%", assemblyName);
            appManifest.Dependency.AssemblyPath = assemblyPath;
            serverDocument.Save();
    

    In new version I am using below code (the project is targeting .NET4),

          Microsoft.VisualStudio.Tools.Applications.ServerDocument.AddCustomization(
            documentLocation,
            assemblyLocation,
            SolutionID, 
            deploymentManifestLocation, 
            true,
            out nonpublicCachedDataMembers);
    

    When I compared the application reports that created using VS2005 version and VS2010 version I have noticed the '_AssemblyName', '_AssemblyLocation' and 'Solution ID' is different in 2 versions. For an example, 2005/Excel 2003 version has * for _AssemblyName but 2010 has '4E3C66D5-58D4-491E-A7D4-64AF99AF6E8B'.

    I have manually modified those parameters of old reports and tried to open them. It was successful. So It seems the 2010 application search for the deployment manifest which is not available in older reports.

    Is this scenario is not supported with VS2010.

    Please help me out with this.

    Thanks in advance.

    /Voshee

    Thursday, July 28, 2011 5:28 AM

All replies

  • Hi!

    Deploying using ClickOne?

    http://blogs.msdn.com/b/vsto/archive/2009/04/29/signing-and-re-signing-manifests-in-clickonce.aspx


    MVP Office Development, MCP, MCTS SharePoint 2010 Development
    Thursday, July 28, 2011 12:48 PM
  • Hi Joao,

    Thanks for the reply.

    I have tried ClickOnce deployment. But still I cannot open the reports (xlsx files) that were created using old (VS2005 and Excel 2003) version. When I extract the .xlsx file I can see it contains following information in xl/activeX/activeX1.bin file

     <assemblyIdentity name="MyApplication.BusinessAnalytics.dll" version="1.0.0.0" />
    
     <asmv2:entryPoint name="Startup" dependencyName="dependency0">
    
      <asmv2:clrClassInvocation class="MyApplication.ExcelReporter.MainWorkbook" />
    
     </asmv2:entryPoint>
    
     <asmv2:entryPoint name="Startup" dependencyName="dependency0">
    
      <asmv2:clrClassInvocation class="MyApplication.ExcelReporter.Sheet1" />
    
     </asmv2:entryPoint>
    
     <asmv2:entryPoint name="Startup" dependencyName="dependency0">
    
      <asmv2:clrClassInvocation class="MyApplication.ExcelReporter.Sheet2" />
    
     </asmv2:entryPoint>
    
     <asmv2:entryPoint name="Startup" dependencyName="dependency0">
    
      <asmv2:clrClassInvocation class="MyApplication.ExcelReporter.Sheet3" />
    
     </asmv2:entryPoint>
    
     <asmv2:dependency asmv2:name="dependency0">
    
      <asmv2:dependentAssembly>
    
       <assemblyIdentity name="MyApplication.BusinessAnalytics" version="1.0.0.0" publicKeyToken="ff90f512e10aef0d" />
    
      </asmv2:dependentAssembly>
    
      <asmv2:installFrom codebase="%MY_ANALYTICS_HOME%\MyApplication.BusinessAnalytics.dll" />
    
     </asmv2:dependency>
    
    
    

    So When I tried to open those files it gives following error,

    System.IO.FileNotFoundException: Could not load file or assembly 'MyApplication.BusinessAnalytics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff90f512e10aef0d' or one of its dependencies. The system cannot find the file specified.
    File name: 'MyApplication.BusinessAnalytics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff90f512e10aef0d'
      at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.HandleOnlineOffline(Exception e, String basePath, String filePath)
      at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.LoadStartupAssembly(EntryPoint entryPoint, Dependency dependency, Dictionary`2 assembliesHash)
      at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.ConfigureAppDomain()
      at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.LoadAssembliesAndConfigureAppDomain(IHostServiceProvider serviceProvider)
      at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.LoadEntryPointsHelper(IHostServiceProvider serviceProvider)
    
    Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
    Running under executable C:\Program Files\Microsoft Office\Office12\EXCEL.EXE
    --- A detailed error log follows. 
    
    === Pre-bind state information ===
    LOG: User = CORPNET\vohelk
    LOG: DisplayName = MyApplication.BusinessAnalytics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff90f512e10aef0d
     (Fully-specified)
    LOG: Appbase = file:///C:/Program Files/MyApplication/Business Analytics/
    LOG: Initial PrivatePath = NULL
    Calling assembly : (Unknown).
    ===
    LOG: This bind starts in default load context.
    LOG: No application configuration file found.
    LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
    LOG: Post-policy reference: MyApplication.BusinessAnalytics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff90f512e10aef0d
    LOG: Attempting download of new URL file:///C:/Program Files/MyApplication/Business Analytics/MyApplication.BusinessAnalytics.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/MyApplication/Business Analytics/MyApplication.BusinessAnalytics/MyApplication.BusinessAnalytics.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/MyApplication/Business Analytics/MyApplication.BusinessAnalytics.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/MyApplication/Business Analytics/MyApplication.BusinessAnalytics/MyApplication.BusinessAnalytics.EXE.
    

    Please note that, I can save, open or distribute the files that are created using new version without any problem. But the problem occurs when I try to open the files that were created using old version.

    Monday, August 1, 2011 8:16 AM
  • Hi!

    Read this, maybe it will help you

    http://msdn.microsoft.com/en-us/library/ee712616.aspx

    http://blogs.msdn.com/b/dougste/archive/2006/09/05/741329.aspx


    MVP Office Development, MCP, MCTS SharePoint 2010 Development
    Monday, August 1, 2011 2:25 PM
  • Hi,

    I have figured out more information about the error.

    I have installed the new application in the user machine ( using MSI ) and have enabled the assembly binding log. and observed the assembly binding exception using fuslogvw.exe. It seems it can successfully find the dll ( The user machine has VSTO runtime version 2 also. Without that it cannot find the assembly path). But it fails because of following error.

    The entry in Assembly binding log:

    *** Assembly Binder Log Entry (8/3/2011 @ 11:57:28 AM) ***
    
    The operation failed.
    Bind result: hr = 0x8013101b. No description available.
    
    Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
    Running under executable C:\Program Files (x86)\Microsoft Office\Office12\EXCEL.EXE
    --- A detailed error log follows. 
    
    === Pre-bind state information ===
    LOG: User = CORPNET\vohelk
    LOG: DisplayName = Ifs.Application.BusinessAnalytics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff90f512e10aef0d
     (Fully-specified)
    LOG: Appbase = file:///C:/Program Files (x86)/IFS Applications/IFS Business Analytics/
    LOG: Initial PrivatePath = NULL
    LOG: Dynamic Base = NULL
    LOG: Cache Base = NULL
    LOG: AppName = NULL
    Calling assembly : (Unknown).
    ===
    LOG: This bind starts in default load context.
    LOG: Using application configuration file: C:\Program Files (x86)\IFS Applications\IFS Business Analytics\Ifs.Application.BusinessAnalytics.dll.config
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
    LOG: Post-policy reference: Ifs.Application.BusinessAnalytics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff90f512e10aef0d
    LOG: GAC Lookup was unsuccessful.
    LOG: Attempting download of new URL file:///C:/Program Files (x86)/IFS Applications/IFS Business Analytics/Ifs.Application.BusinessAnalytics.DLL.
    LOG: Assembly download was successful. Attempting setup of file: C:\Program Files (x86)\IFS Applications\IFS Business Analytics\Ifs.Application.BusinessAnalytics.dll
    LOG: Entering download cache setup phase.
    ERR: Error extracting manifest import from file (hr = 0x8013101b).
    ERR: Setup failed with hr = 0x8013101b.
    ERR: Failed to complete setup of assembly (hr = 0x8013101b). Probing terminated.

      Do you have any clue on this. Greatly appreciate your help regarding this.

     

    Wednesday, August 3, 2011 8:35 AM
  • Hi!

    Are you target to NF 4.0?

    Create a App.config file and paste this

     

    <?xml version="1.0"?>
    <configuration>
     <startup>
     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
     </startup>
    </configuration>
    

    Any news?

     


    MVP Office Development, MCP, MCTS SharePoint 2010 Development
    Wednesday, August 3, 2011 10:39 AM
  • Hi,

    Yes I am targetting .NET framework 4.

    I already have that entry in my App.config file.

    <?xml version="1.0"?>
    <configuration>
     <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
        <assemblyIdentity name="Microsoft.Office.Interop.Excel" publicKeyToken="71E9BCE111E9429C" culture="neutral"/>
        <bindingRedirect oldVersion="14.0.0.0" newVersion="12.0.0.0"/>
       </dependentAssembly>
       <dependentAssembly>
        <assemblyIdentity name="Office" publicKeyToken="71E9BCE111E9429C" culture="neutral"/>
        <bindingRedirect oldVersion="14.0.0.0" newVersion="12.0.0.0"/>
       </dependentAssembly>
       <dependentAssembly>
        <assemblyIdentity name="Microsoft.Vbe.Interop" publicKeyToken="71E9BCE111E9429C" culture="neutral"/>
        <bindingRedirect oldVersion="14.0.0.0" newVersion="12.0.0.0"/>
       </dependentAssembly>   
      </assemblyBinding>
     </runtime>
     <appSettings>
      <add key="UseRoamingProfile" value=""/>
     </appSettings>
    <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
    
    
    Thanks, but still struggling.

    Wednesday, August 3, 2011 11:05 AM
  • OK

    What do you have in the FILE.exe.config?

     


    MVP Office Development, MCP, MCTS SharePoint 2010 Development
    Wednesday, August 3, 2011 11:12 AM
  • I guess it is about MyApp.dll.config you are referring. Its same there also.

    <?xml version="1.0"?>
    <configuration>
     <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
        <assemblyIdentity name="Microsoft.Office.Interop.Excel" publicKeyToken="71E9BCE111E9429C" culture="neutral" />
        <bindingRedirect oldVersion="14.0.0.0" newVersion="12.0.0.0" />
       </dependentAssembly>
       <dependentAssembly>
        <assemblyIdentity name="Office" publicKeyToken="71E9BCE111E9429C" culture="neutral" />
        <bindingRedirect oldVersion="14.0.0.0" newVersion="12.0.0.0" />
       </dependentAssembly>
       <dependentAssembly>
        <assemblyIdentity name="Microsoft.Vbe.Interop" publicKeyToken="71E9BCE111E9429C" culture="neutral" />
        <bindingRedirect oldVersion="14.0.0.0" newVersion="12.0.0.0" />
       </dependentAssembly>
      </assemblyBinding>
     </runtime>
     <appSettings>
      <add key="UseRoamingProfile" value="FALSE" />
     </appSettings>
     <startup>
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
     </startup>
    </configuration>
    


    Wednesday, August 3, 2011 11:38 AM
  • Hi

    Can you disable all AntiVirus protections in your PC and try again?

    The goal is to deactivate "Protection Against Unknown Threats"


    MVP Office Development, MCP, MCTS SharePoint 2010 Development
    Wednesday, August 3, 2011 1:18 PM
  • Hi,

    Here is the Assembly binding log entry for a report that is created using new version. It can be opened without any problem,

    ---------------------------------------------------------------------------------------------------------------------------------------------

     

    *** Assembly Binder Log Entry (8/3/2011 @ 5:33:04 PM) ***
    
    The operation was successful.
    Bind result: hr = 0x0. The operation completed successfully.
    
    Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
    Running under executable C:\Program Files (x86)\Microsoft Office\Office12\EXCEL.EXE
    --- A detailed error log follows. 
    
    === Pre-bind state information ===
    LOG: User = CORPNET\vohelk
    LOG: DisplayName = Ifs.Application.BusinessAnalytics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff90f512e10aef0d, processorArchitecture=MSIL
     (Fully-specified)
    LOG: Appbase = file:///C:/Program Files (x86)/IFS Applications/IFS Business Analytics/
    LOG: Initial PrivatePath = NULL
    LOG: Dynamic Base = NULL
    LOG: Cache Base = NULL
    LOG: AppName = NULL
    Calling assembly : Microsoft.VisualStudio.Tools.Office.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
    ===
    LOG: This bind starts in default load context.
    LOG: Using application configuration file: C:\Program Files (x86)\IFS Applications\IFS Business Analytics\Ifs.Application.BusinessAnalytics.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: Ifs.Application.BusinessAnalytics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff90f512e10aef0d, processorArchitecture=MSIL
    LOG: GAC Lookup was unsuccessful.
    LOG: Attempting download of new URL file:///C:/Program Files (x86)/IFS Applications/IFS Business Analytics/Ifs.Application.BusinessAnalytics.DLL.
    LOG: Assembly download was successful. Attempting setup of file: C:\Program Files (x86)\IFS Applications\IFS Business Analytics\Ifs.Application.BusinessAnalytics.dll
    LOG: Entering download cache setup phase.
    LOG: Assembly Name is: Ifs.Application.BusinessAnalytics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff90f512e10aef0d
    WRN: A duplicate assembly was found while copying the assembly item to the cache.
    LOG: Binding succeeds. Returns assembly from C:\Users\vohelk.CORPNET\AppData\Local\assembly\dl3\EW5V1QLO.EA6\2Q7P5Y93.5A0\51e5225b\00deeb28_a251cc01\Ifs.Application.BusinessAnalytics.dll.
    LOG: Assembly is loaded in default load context.
    

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    I have noticed the It has a value for Calling Assembly: Microsoft.VisualStudio.Tools.Office.Runtime, version = 10.0.0.0

    But in the log for the old report we can see "Calling Assembly : Unknown"

    Is this observation leads to any clue?

    Thank you,

     

    Thursday, August 4, 2011 4:20 AM
  • Hi Joao,

    I have tried again after disabling the AntiVirus protection.

    But still no result.

    Please reply if you have any suggestions.

    Thank you.

    /Voshee

    Monday, August 8, 2011 3:52 AM
  • Hi!

    1 - Try to find in your code Obsolete or Deprecated methods, fix

    2 - Try to change the PFX in Signing - Sign the Assembly, creating a new one.


    MVP Office Development, MCP, MCTS SharePoint 2010 Development
    Monday, August 8, 2011 3:42 PM
  • Hi voshee,

     

    Thanks for posting in the MSDN Forum.

     

    Did you try Joao’s solution? I will mark Joao’s reply as an answer. If you feel Joao’s solution doesn’t solve your main goal, please feel free to unmark it.

     

    Have a good day,

     

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, August 11, 2011 3:56 AM
    Moderator
  • Hi Tom,

    Yes I have tried all the suggestions. But still I am struggling with the problem. 

    So I am afraid, above solutions does not solve my main goal.

    Thank you.

    -Voshitha

    Monday, August 22, 2011 5:39 AM