Run as admin? :)
My program works correctly within the visual studio. Outside, displays a COM error (System.Runtime.InteropServices.COMException (0x80004005): HRESULT error E_FAIL)
My program uses adobe reader dll to display pdf within a form. In visual studio the program works correctly, but when I run it out of vs 2019 it presents an error. I believe it's some missing reference.
OBS: before the project was in version 4.7.2 of .net. I've updated the entire program to 4.8. Maybe this caused some mismatch? Incompatibility that does not exist when running the program direct by vs.
PDFView_Load:
private void PDFView_Load(object sender, EventArgs e)
{
try
{
PDFViewObj.src = @"C:\Biblioteca Fácil\tempPDF.pdf"; //this file is created by other class
}
catch(COMException)
{
//Recovery options here
Error = true;
this.Close();
}
}
This is my Exception that just occurs if executed outside the vs 2019:
System.Runtime.InteropServices.COMException (0x80004005): Erro HRESULT E_FAIL was returned from a call to the COM component.
in AcroPDFLib.IAcroAXDocShim.set_src(String pVal)
in AxAcroPDFLib.AxAcroPDF.set_src(String value)
in biblioteca.PDFView.PDFView_Load(Object sender, EventArgs e) na C:\Users\manoe\Documents\Backup de segurança\Biblioteca\biblioteca\biblioteca\PDFView.cs:linha 16
in System.Windows.Forms.Form.OnLoad(EventArgs e)
in System.Windows.Forms.Form.OnCreateControl()
in System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
in System.Windows.Forms.Control.CreateControl()
in System.Windows.Forms.Control.WmShowWindow(Message& m)
in System.Windows.Forms.Control.WndProc(Message& m)
in System.Windows.Forms.ScrollableControl.WndProc(Message& m)
in System.Windows.Forms.Form.WmShowWindow(Message& m)
in System.Windows.Forms.Form.WndProc(Message& m)
in System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
in System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
in System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Developer technologies | .NET | .NET Runtime
Developer technologies | Visual Studio | Debugging
Developer technologies | C#
2 answers
Sort by: Most helpful
-
-
Tianyu Sun-MSFT 34,441 Reputation points Microsoft External Staff
2021-06-14T09:34:32.467+00:00 Hello @Manoel Victor ,
Welcome to Microsoft Q&A forum.
Perhaps you can try to
Publish
your project. Right-click your project > Publish and follow thePublish
wizard. You can also change some settings(add some files) ofpublish
from right-clicking your project > Properties > Publish > (optional) Install Mode and Settings > (optional) Application Files…Best Regards,
Tianyu- If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
- If the answer is helpful, please click "Accept Answer" and upvote it.