.NET Framework Developer Center > .NET Development Forums > Common Language Runtime > Unable to install or run the application, the application requires the assembly Interop.Office 2.1.0 to be installed into GAC first
Ask a questionAsk a question
 

AnswerUnable to install or run the application, the application requires the assembly Interop.Office 2.1.0 to be installed into GAC first

  • Friday, October 30, 2009 9:30 PMMr. Javaman Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Been fighting this for two days now. 
    This is a clickonce deployment using VSExpress 2008 C#....  when publishing I get the message above when trying to test the install.
    Under Project properties/Publish/Application Files I don't see a Interop.Office 2.1.0 entry.  So I added the Office 2.1.0 reference in solution explorer then went in to the Application Files view and forced it to be included and required.  Same problem.

    History:  About a week or two ago I was experimenting with strong naming and certificates.  I've since undone or thought I've undone all of that and am using a test certificate to deploy.  I've tried hacking at all the Application File settings for the Office listing to no avail.

    Is there file name of "Interop.Office" that has to be in there in order to deploy it to the bin directory to run from there?


     

    Javaman

Answers

  • Monday, November 02, 2009 5:45 PMMr. Javaman Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Found the solution:

    I had a reference to a class library I had developed.  In that class library there was a reference to Interop.Office 2.1.0.0 and it's file property values were set to "Copy Local".  Class libraries don't have same Include options for Publishing because they aren't published.  Once I changed those values to Copy Local = False and then went into the other application's publish properites page, under Application files I made sure that the option for that dll was set to Include(Auto).  Everything worked....

    I think this is a bug in either the VS C# oneclick code because.... 1) Why couldn't the CLR probe find the assemblies in the base class library?  2) The application had been tested with both Include(Auto) and Include, neither worked because it said the file already existed.  The only way around it was to set the base class library to copy local false....  I am guessing that the include at the application level was the place where the Office dlls were included from, which required the application to hold a reference to the same Office dlls as the base class.  That doesn't make sense to me in a one time one place methodology. 

    Perhaps I should have attached Windbg to find the probe locations.  The problem with oneclick is that as soon as there's a failure the temp files are removed so you can't see the layout of what was going on after the failure.  Windbg is the only way to view the probing locations for the needed dlls.

    ARGH! 
    Javaman
    • Marked As Answer byMr. Javaman Monday, November 02, 2009 5:45 PM
    •  

All Replies

  • Saturday, October 31, 2009 12:41 AMMr. Javaman Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Did find one additional clue, the Interop.Office includes come with .net framework.  Adding the Office.dll reference does not satisfy the requirement.  Still having problem though.
    Javaman
  • Saturday, October 31, 2009 12:45 AMReed Copsey, Jr. Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    You'll need to redistribute the Office Primary Interop Assemblies to your end users, and have that installer run.  You will not be able to do a single ClickOnce deployment that includes this - so I'd recommend having them install that first.

    For details, read How To: Install Prerequisites on End User Computers to Run Office Solutions.  It walks through the requirements and procedures to make this work.


    Reed Copsey, Jr. - http://reedcopsey.com
  • Monday, November 02, 2009 3:15 PMMr. Javaman Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Reed;
      Never had to do this before.  I've recently changed something by accident or intentional within the application but can't pinpoint.  If I go to the application files and mark these Interop.Office files as Include I thought the install would include them and look there first.  In fact the documentation says that the only time the GAC option is required would be if they are set to Prerequisites which means they are not in the install.
    Javaman
  • Monday, November 02, 2009 4:04 PMMr. Javaman Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Ok looking into the prerequistes menu, I don't see Microsoft Office 2007 Primary Interop Assemblies listed  or any other Primary Interop Assemblies.  Sounds like I may have a corrupt .NET Framework.  I thought I had read that the Interop assemblies are included in the .NET Framework.  I've gone to the Office site and downloaded the Primary Interop Assemblies and run the install for that, but don't see change in Prereq selctions in Properties explorer.  Arghhh! 

    I think I'm going to uninstall all .NET framework versions on my computer and install just one.  Hopefully that won't kill me.
    Javaman
  • Monday, November 02, 2009 5:02 PMMr. Javaman Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Bit more information, if I add a reference to the project (COM) of OFFICE, and then click on that reference in Solution Exporer I see that the properties window shows that this is Interop.Office and the version is 2.1.0.0.  Now if I go to Publish/Properties I see INTEROP.OFFICE.DLL and I change it to INCLUDE.  I still get same results that it's looking for it in the GAC....  I don't get it.
    Javaman
    • Unmarked As Answer byMr. Javaman Monday, November 02, 2009 5:37 PM
    • Marked As Answer byMr. Javaman Monday, November 02, 2009 5:36 PM
    •  
  • Monday, November 02, 2009 5:45 PMMr. Javaman Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Found the solution:

    I had a reference to a class library I had developed.  In that class library there was a reference to Interop.Office 2.1.0.0 and it's file property values were set to "Copy Local".  Class libraries don't have same Include options for Publishing because they aren't published.  Once I changed those values to Copy Local = False and then went into the other application's publish properites page, under Application files I made sure that the option for that dll was set to Include(Auto).  Everything worked....

    I think this is a bug in either the VS C# oneclick code because.... 1) Why couldn't the CLR probe find the assemblies in the base class library?  2) The application had been tested with both Include(Auto) and Include, neither worked because it said the file already existed.  The only way around it was to set the base class library to copy local false....  I am guessing that the include at the application level was the place where the Office dlls were included from, which required the application to hold a reference to the same Office dlls as the base class.  That doesn't make sense to me in a one time one place methodology. 

    Perhaps I should have attached Windbg to find the probe locations.  The problem with oneclick is that as soon as there's a failure the temp files are removed so you can't see the layout of what was going on after the failure.  Windbg is the only way to view the probing locations for the needed dlls.

    ARGH! 
    Javaman
    • Marked As Answer byMr. Javaman Monday, November 02, 2009 5:45 PM
    •