Exceptions from Excel API after downgrading from 2013 to 2010 - c#

After downgrading from Excel 2013 to 2010 (i.e. removing 2013 and installing 2010) when I try to access the Excel OM from my add-in like this:
if (this.Application.ActiveWorkbook == null)
{
return;
}
I get the following Exception:
Unable to cast COM object of type 'System.__ComObject' to interface
type 'Microsoft.Office.Interop.Excel._Application'. This operation
failed because the QueryInterface call on the COM component for the
interface with IID '{000208D5-0000-0000-C000-000000000046}' failed due
to the following error: Library not registered. (Exception from
HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).
I have taken the following steps to resolve the issue but none have worked:
Repaired the office installation
Uninstalled and reinstalled
Cleared out all office 15 references from the registry
Re-registered Excel ("C:\Program Files (x86)\Microsoft Office\Office14\excel.exe" /o)
However, nothing seems to work. Is there something I'm missing or do I actually have to wipe the machine?
EDIT:
My guess is that there is still come conflict in the registry but I have no idea where...
Thanks in adv!

Found the solution - I forgot to remove one reference to Excel 2013:
HKEY_CLASSES_ROOT\TypeLib{00020813-0000-0000-C000-000000000046}\1.8
After removing 1.8 my corrected registry looks like this:
...
Credit: http://www.c-sharpcorner.com/Forums/Thread/203666/unable-to-cast-com-object-of-type-microsoft-office-inte.aspx

Related

Error : 800700c1 in instantiating an object for Microsoft.Office.Interop.Excel.Application

I am getting the below error when instantiating the Microsoft.Office.Interop.Excel.Application() for generating Excel from the winforms app.
This was working before and suddently it stopped working eventhough there was no change in code and in version of excel. Only change I could see is there were some windows 10 updates getting installed in past weeks but I am not sure whether that was the cause for the problem
retrieving the com class factory for component with clsid {00024500-0000-0000-c000-000000000046} failed due to the following error : 800700c1.
I could see many solutions for access denied (error: 80070005 Access is denied) for the same type of operation, but none for error : 800700c1.
I am running the application in 32 bit and I have re-installed the office 2016 (32-bit) suite but still I am getting the error.
Any help in direction of solving would help.
Deleting the file "C:\Program" fixed the issue. No idea how the file was created and why deleting it solve the excel generation problem.
Just to piggyback off of Vignesh AJ's solution, this Program file seems to have appeared after a Citrix Workspace for Windows update. The file can be moved or deleted from C drive to solve the problem.
In my case c:\Program was created by Notepad++, and yes removing it did help.

Running CodedUI Test From Another Application

I'm planning to run my coded UI test from another project (in same solution). I added a reference of the CUIT project to my winform app project. Also I added these references as well
Microsoft.VisualStudio.TestTools.UITesting.dll
Microsoft.VisualStudio.QualityTools.CodedUITestFramework.dll
Microsoft.VisualStudio.TestTools.UITest.CodeGeneration.dll
Microsoft.VisualStudio.TestTools.UITest.Framework.dll
Microsoft.VisualStudio.TestTools.UITest.Playback.dll
My code is something like this
Playback.Initialize();
TestProject.CodedUITest1 coded = new TestProject.CodedUITest1();
coded.CodedUITestMethod1();
Playback.Cleanup();
However, I get an exception on the Playback.Initialize() call.
this is the message...
"An unhandled exception of type 'Microsoft.VisualStudio.TestTools.UITest.Extension.PlaybackFailureException' occurred in Microsoft.VisualStudio.TestTools.UITesting.dll"
Someone said that installing Test agent 2010/Test agent10 can solve this error.
I installed MS Visual studio Test Agent 2010, but same error happens.
What am I doing wrong here?
Thanks
I tried to run the test the same way you do and it worked for me.
Below are the reference dlls I have added in my projects
Please make sure you have added all the dlls. In case you are not able to find the dlls, look for them in C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies.
If this doesn't work please provide the details of inner exception.
I found an answer to my problem. I found that the message of the inner exception is
"Retrieving the COM class factory for component with CLSID {27876903-E697-4406-BF49-1B8B92CB8735} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))."
After digging around I found that I have a 32 bit third party dll which I'm running on my 64-bit machine. The conflict is 64 bit process trying to invoke 32 bit process in 64 bit machine.
The solution is to change the project properties to target to 'X86' machine instead of 'Any'.

SSIS Script Component Cannot Load Assembly Until Manually Opened

I am creating a SSIS project via Biml (Using the current version of BimlExpress per the Varigence BimlExpress page) that uses a script component within a Data Flow Task. The project is created without issue however errors when it gets to the Script Component:
Could not load file or assembly 'Microsoft.SqlServer.DTSPipelineWrap, Version=14.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
at ScriptMain.PreExecute()
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PreExecute()
I can see this dll within the GAC and when I try to add the reference manually, SSIS states that I can't add it as it is already included in the project.
However, if I open the Script Component and manually Build it - but change nothing else - the Data Flow Task will run through without issue.
To clarify, I know I have changed nothing else as I am recreating this project from the Biml each time I want to test a new approach, which provides a consistent baseline.
Does anyone know why a Script Component that includes a reference to a GAC dll, will only work when manually Built but not beforehand?
I have used this exact Biml before without issue, though on a different environment. Worked using Visual Studio 2012 against a SQL Server 2016 instance yet doesn't here within Visual Studio 2015 (targeting 2012) against a SQL Server 2016 instance.
For further context I have also tested this outputting the SSIS Project targeted at SQL Server 2012, 2014 and 2016 with the exact same error message.
Update
This appears to definitely be a dll version problem in the project as output from BimlExpress, in that if I manually create the v4.0_14.100.0.0__89845dcd8080cc91 folder with the version 13 dll inside at C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SqlServer.DTSPipelineWrap the script component now errors out with the following:
System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSComponentMetaData100'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{ID removed just in case}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e)
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PreExecute()
at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostPreExecute(IDTSManagedComponentWrapper100 wrapper)
I guess your problem may be related to the Express version.
See at the related page the differences between Express and BimlStudio versions (Feature Comparison Chart under "Compare with BimlStudio" button):
https://www.varigence.com/BimlExpress
I had the same issue with the Data Profiling component. I used the following post.
ssis-data-profiling-task-editor-return-error-codes

Unable to cast COM object - error: No such interface supported

I've got this annoying issue in here when using a VB6 DLL (AB5COM.dll) in my webAPI project.
All is working fine in my local VS2015. The problem occurs only in my remote IIS 7.5 (Win2008 R2) after deploying the published site.
I'm using this DLL in 2 projects of my solution.
I've tried several things -
Generating interop.AB5COM
Disable embed and copy local
platform change to x86
APP POOL supports 32bit
[assembly: ComVisible(true)]
Adding [Guid("xxxxxxx-xxxxx-xxxxxx-xxxxxx")] as attribute in my class
All was useless. Local VS2015 works, remote IIS7.5 fails with this exception.
System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'AB5COM.trxAB5core'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{AF42661C-D369-454A-A005-55D51037166A}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
I also can't find which DLL I need to register using regsvr32 since the COM dll isn't published, and the interop cannot be registered.
Would appreciate your help on this.
Thx
Ok, since no answer on this, I had to make some moves...
The remote IIS environment is my TEST server, so I've installed VS2017 with my solution, ran my app (success) and published (success).
So currently I have no issues with this COM DLL which brings the conclusion that this is a pure REGISTRY issue. The VS2015 knows how to register the correct DLL and then all works perfectly.
Now, I need to figure how to make this working on my Production...
Although this is NOT a proper solution, I hope my personal post helps anyone.

Unable to load excel file using Microsoft.Office > interop.Excel

In my WPF application I am using Microsoft.Office.Interop.Excel to import data from excel file. I have been using this code for last couple of months and it has been working just fine for me. Today all of a sudden when I ran the utility I got the following error.
Unable to cast COM object of type
'Microsoft.Office.Interop.Excel.ApplicationClass' to interface type
'Microsoft.Office.Interop.Excel._Application'. This operation failed
because the QueryInterface call on the COM component for the interface
with IID '{000208D5-0000-0000-C000-000000000046}' failed due to the
following error: Library not registered. (Exception from HRESULT:
0x8002801D (TYPE_E_LIBNOTREGISTERED)).
I had originally Office 2013 installed but 2 months ago I uninstalled and installed the 2007 version. Everything was working fine until now.
I have read on different posts to delete the registry entry corresponding to the above IID. I have tried doing that but no help. I uninstalled/repaired Office as well but no help.
I have tried to register the Microsoft.Office.interop.excel.dll using regasm.exe as well but again no luck. Whats the issue here?
I had a some problems with Interop. then I switched to Microsoft.Jet.OLEDB.4.0 don't know if it helps, but I found it to be much more stable.

Categories