Click once deployment - deployed application runtime error - c#

I used the deploy feature from VS community 2017 for a custom level excel workbook 2010. The installation package got created on the client computer.
I could run the setup and checked that the workbook was installed.
At run time I got hang on an exception which I figured means that VSTO runtime library is not properly set.
Here is the error message I got (this is french sorry about that - word to word it says "Element not found":
System.Runtime.InteropServices.COMException (0x80070490): Élément introuvable. (Exception de HRESULT : 0x80070490)
à Microsoft.VisualStudio.Tools.Office.Runtime.Interop.IHostItemProvider.GetHostExtender(String extenderType, String extenderCookie, IntPtr& extenderObject)
The workbook has a button layed on the surface of a sheet on some code C#.NET attached to the document.
It works and run on the development host not on the client host. Both are windows 10 OS.
The deployed components are :
.NET Framework 4.5.2
VS 2010 for Office Runtime
checking on the client computer I see .NET 4.6.* and VS 2010 for Office Runtime installed.
Theoretically .NET.4.6.* is backward compatible .NET 4.5.2.
Digging deeper I think something is wrong with VSTO run time. I ve read that the VSTO system runtime includes libraries used for the Microsoft.VisualStudio.Tools namespace. What's weird is that there is the same interface but in another namespace, Microsoft.Office.Tools, which is hardly not document ("This API supports the product infrastructure and is not intended to be used directly from your code").
I also have checked that the PIA is installed for Office and Excel.
I had VS 2017 installed on that computer afterward (after trying to run the deployed workbook).
I used the exact same code, built the solution and got the same exception !
Any clue on what to check ?

Related

Office 2016 automation

I have an legacy Excel project that automates Excel 2007 on our server in order to produce overnight user-authored reports. It has worked fine but recently on trying to upgrade to Office 365 (also tried 2016) I came across a problem where it appears to throw COMException 0x800AC472 after creating the Excel.Application object.
I can create the object without error but as soon as I try to call any methods of the Application object it faults.
This is a brand new vanilla server with .Net 4.6 and 3.5 installed and Office 365, nothing else.
The code has been re-linked using COM to reference Office 15.0 Interop. And the same code still works perfectly on the old 2007 server.
Microsoft.Office.Core 16.0
Microsoft.Office.Interop.Excel 16.0
The Error message in full:
System.Runtime.InteropServices.COMException (0x800AC472): Exception from HRESULT: 0x800AC472
at Microsoft.Office.Interop.Excel.ApplicationClass.set_DisplayAlerts(Boolean RHS)
at ExcelReportingService.ExcelJob.ProcessExcelBook(String location, String savePath, String testEmailsOnlyTo, Boolean allowEmptyResultFile, StringBuilder& processResults) in W:\\Group\\VIP\\Services\\ExcelReporting\\Classes\\ExcelJob.cs:line 136
The code has never had an install package and I'm not sure if this is this is the issue? Currently I am just copying the DLLs for the app to the service folder and installing with "sc create". I have not installed any other runtimes or copied any DLLs into the GAC? But I don't do this with the working 2007 server either?
Am I missing a runtime I need to install on the server?
PS: I do recognize the reality that Microsoft has said that server automation is not supported for Office, but this is a legacy project that I need to get working as all servers are being upgraded and Office 2007 will not install on newer servers.

unable to install or run C# application on client PC

I have developed a desktop application in c# & SQL server 2012 using Visual Studio 2013. I have included the reference for Microsoft.VisualStudio.DebuggerVisualizers and set copy local : true.
The application runs perfectly on client systems with windows 8, 10.
But its showing this error while installing on a windows 7 system.
- OS Windows 7 Ultimate
- already installed .NET Framework 4.5
- installed Report Viewer.exe 2012
- installed report viewer.msi 2010
- installed sqlclr types
- the system doesnt have any microsoft c++ redistributable , i am not sure whether it has any impact.
I checked in the assembly folder, but couldnt find the Microsoft.VisualStudio.DebuggerVisualizers.dll
Am I missing any prerequisites here? How to solve this issue so that i can install the application
Error Message
It needs the Microsoft.VisualStudio.DebuggerVisualizers.dll in the global assembly cache. The GAC is the area where libs are placed which can be accessed from all of the system.
It's kinda a ugly fix but you could place this lib in the same or subdirectory of the same directory where the application is.
Is it possibly that you haven't installed VS on that Win7 machine but on the others?
Unintentionally the Microsoft.VisualStudio.DebuggerVisualizers.dll had been included in the project reference. And in the client system the specified dll could not be found even after trying to install it. Hence I removed it from reference and then it worked perfectly fine without any issues. I guess instead of report visualizer i have included debuggervisualizer. It was a manual error.
Thank you for your support

Excel Addin : Workbook refresh with data mode , Error : The cartridge directory could not be found

I had a 2013 32-bit excel (Professional edition) and I am developing an addin. In this addin I refresh a excel workbook. This workbook has a Data Model. My OS was recently upgraded from Windows 8 to Windows 10.
When I was refreshing the workbook through code, it throws me an error :
"We couldn't get data from the Data Model."
The cartridge directory could not be found. Use the Windows Installer to repair the application. Exception of type 'Microsoft.Office.PowerPivot.BackEnd.StorageException' was thrown."
I saw this link in MSDN forums and tried to install 32 bit of those Hotifixes mentioned in the link, but it said "The hotfix was already installed".
I thought that may be something got corrupt while upgrade from Windows 8 to Windows 10. So I uninstalled 32-bit of office and restarted machine. Then I installed the Office 64-bit Professional version.
I then again tried to install the 64 bit version of the hotfixes but again got message "There is no software to apply this hotfix".I tried to run the add in code again but it again threw the same error again. My 64-bit machine is a click and run version of office (I checked in registry based on a article).
I do not think for my new 64 bit office, no updates are applied. I am not sure what is causing the error. Please advise.
My question are:
Any suggestion what could be happening
In Click and Run version of office 2013 , how do I update (All updates available) that ? I do not see any way I can update.
Is this issue resolved in any SP or CU.
Any way to resolve this?
I am currently stuck with this. Note : It works when manually refreshing. Just throws error when doing this through C# code.
Girija

Excel interop works on machine with Office 2007 but fails on machine with Office 2010

I have a C# WPF (.NET 4.0) application that uses Excel interop to read data from an Excel file.
When I run this app on my development machine, which has Excel 2007, it works fine. When I run it on another machine that has Excel 2010 installed on it, it fails with the following error message:
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT:0x80040154 (REGDB_E_CLASSNOTREG)).
The failure occurs when attempting to create a Microsoft.Office.Interop.Excel.Application object, as in:
var app = new Application();
My project has a reference to Microsoft.Office.Interop.Excel.dll (version 14.0.0.0, runtime version v2.0.50727), which is located at:
C:\Program Files\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office14\Microsoft.Office.Interop.Excel.dll
I tried to run the app with the default settings on the referenced dll:
Copy Local = False
Embed Interop Types = True
Specific Version = True
I also tried to run the app with the following settings on the referenced dll:
Copy Local = True
Embed Interop Types = False
Specific Version = True
But on the machine with Office 2010, neither of these attempts worked.
Other notes: The machine with Office 2010 is 64-bit w/ Windows 7. My development machine is X86 with Windows XP.
Question
What is causing the "class not registered" exception and how do I fix it?
Edit
In response to Alex's answer, I tried building the app as Any CPU, X86, and X64, but it made no difference. I'm still getting the same "class not registered" error.
Edit 2
Just tried the app on a 32-bit machine with Office 2010. No errors. So, it could be something wrong with the particular machine, or it could be the combination of 64-bit and Office 2010.
Edit 3
Okay, so now I've tested it on a different 64-bit machine with Office 2010. Again no errors. I think this means something is wrong with the particular machine and it's not my software's fault. Ahh programming.
Preliminary answer: my software was fine and something was wrong with the setup on that particular machine.
Edit
I just found out something that is probably the source of the problem. The problem machine has Office, but it is set up as click-to-run (runs off the internet) rather than MSI-based (runs from an EXE). This means that certain registry settings, DLLs, components, etc. are not available to Microsoft.Office.Interop.Excel, so it fails.
Edit 2
That was definitely the problem. Just upgraded to a full MSI-based installation of Office, and everything works great.
Edit 3
Added this as a bug to Microsoft Connect:
https://connect.microsoft.com/VisualStudio/feedback/details/672276/excel-interop-fails-on-machine-where-office-is-installed-as-click-to-run#details

Unable to run c#application (using c++ dll) in some PCs

we have created a c# application which calls a c++ dll(sdbm.dll). It is working properly in most of the PCs except some PCs. The dll is created using VC++ 2008 and application is done in VC# 2005. Following are the errors occured when the dll functions are called from the C# application.
Error occured in one PC is as follows
=====================================
Unable to load sdbm.dll :This application has failed to start because the application configuration is incorrect.Reinstalling the application may fix this problem (Exception from HRESULT :0x800736B1)
Error occured in 2nd PC
=====================================
Error Signature
Appname:app.exe Appver:1.0.0.0 Modname:msvcr90.dll Modver:9.0.30729.4148 Offset:0002fc96
Any help would be appreciated
As the others already stated in their comment it seems to be a problem with the dependencies of your sdbm.dll. The simplest way to find out the root cause you should get a copy of DependencyWalker and throw your sdbm.dll into it. First on a machine where it runs without any problems and afterwards start DependencyWalker on one of the problematic machines to see it's output.
It gives you some informations about what DLLs it couldn't found on the current machine. Thous leading you to the problematic libraries.
Nearly always the problem is a missing Visual C++ Redistributable Package (2005, 2008, 2010) or that your library is compiled and deployed as debug version. In this case it will link to the debug versions of e.g. mfcxx.dll by using the mfcxxd.dll. But these debug versions are only installed with the corresponding SDK (or Visual Studio) and not with the redistribution package. Thus leading to problem on the user machine but not no a developer machine.

Categories