Could not load file or assembly exception, only on other machines - c#

I'm currently working on a program in C# WPF. I use an external dll called Irrklang. It's made for x86 only so I set VS to compile for x86. I added the reference, set the copy local to true and set the dll as Required in the application files.
When publishing the app using clickonce I upload it. I install on two machines: my dev machine and another machine. On my dev machine things work fine. On the other machine I get the could not load file or assembly exception through my error handling I added to my app. In the event log there is a xamlparse exception.
How can I solve this when everything works fine on my dev machine. I tried Dependencywalker but that doesn't show anything and I made sure the dll is in the folder of the executable. I ask this question again here on stackoverflow, the last time someone made me an empty app with a reference to the dll and he installed it on 3 other machines and it worked fine. I published his app like I did with my own and it shows the exact same problem!
Please help me out
UPDATE: I was thinking about it but your comment beat me to it! :D I program .net 4 Extended and it is set as a prerequisite. VS C# Express 2010.

Well, no specific advice then. It sounds like you just need to some old school trial and error... Whiddle the app down to something that will distribute correctly with ClickOnce and keep adding functionality until it doesn't!

Related

WinForm .exe application loads a blank screen when published

I have an antique application using cefsharp.commons dll and I had to update a small part for the api communication.
The problem is that when I run the application on visual studio it works perfectly but when I publish, it installs but loads a blank screen instead of the usual UI.
I've searched different articles on ways to publish using clickonce and it seems the publish its correct.
I´ve also saw the logs on the event viewer application on windows and I have the following messages
Name of application failing: CefSharp.BrowserSubprocess.exe, version 43.0.0.0 name of failing module: KERNELBASE.dll
also:
Excpetion: System.IO.FileNotFoundException
em CefSharp.BrowserSubprocess.Program.Main(System.String[])
But the enviromment runs the previous version so i dont think my windows is missing any dependencies.
I would really appreciate any help.
best regards.
For some reason my application was not caring the cefsharp files when the clickonce application generates the dlls on the receiving computer.
The solution I had to do was manually add the dlls on the project folder (On the roots, besides having it on the reference added).
it is certainly some bug between generating the deploy dependencies and generating it back on installation.

Unable to load DLL 'SQLite.Interop.dll': The specified module could not be found. Error on Windows Server 2012

I have a multi-project solution (C#) that I am trying to deploy to one of our test servers. All the projects are being built for x64, with the 'Prefer 32 bit' disabled where applicable.
Some of the projects reference a SQLite dll set that uses the SQLite Encryption Extension (not managed by nuget). When I build and install the solution on my local dev machine, the application and windows service are able to function properly, no problems.
When I try to install the same package on one of our test servers, running 64-bit Windows Server 2012, I get the "Unable to load DLL 'SQLite.Interop.dll': The specified module could not be found." whenever I try to communicate with the SQLite database. I have triple checked that all the appropriate DLLs are in the program folder after installation.
In my VS solution, I have tried creating the x86/x64 folders, setting Copy to Always, but to no avail. I have also copied the DLLs from my local install folder into the server folder just to see if something got messed up along the way.
Could it be a permissions issue? I'm an elevated user but not a full admin on the server, whereas I'm a full admin on my machine. I've tried manually modifying the permissions on the program folder to see if that was an issue, but had no luck with that either.
So to summarize, the project is being explicitly built for x64, it has the right DLLs in the right folders, and it works on a local install. I'm at a loss as to why it won't work on the server install. I've looked through countless threads on StackOverflow, MSDN, and SQLite's website, all usually suggesting the x86/x64 folders, but that hasn't been working for me. I'm hoping someone can help me out here.
Thanks!
Was actually able to figure it out after a bit more debugging. The Visual C++ runtime that was installed on the server wasn't the right version. I added the Merge Module to the installer for the version my project was expecting, reinstalled the app on the server, and now it's working beautifully.
For those who have this issue, look for the right version of the VC++ runtime in C:\Program Files(x86)\Common Files\Merge Modules. If you don't know what version you need, use something like dependency walker on the machine that is throwing the error. Mine told me I was missing VC140, so that's the module I copied into my project and added to the installer.

Chromium embedded framework(CEF). could not load cefsharp.core.dll issue

I am Using CEF(Chromium Embedded frame work) in my windows application. its working fine in my machine. but after it is installed in user machine, not working. not sure which file is missing. i hope i dont want to do anything with the code as its working locally.
Getting the below error for the users
using VS2015 -
framework:4.5.2 -
cefsharp dll :51.0.0.0
I also make sure required files are there after installation see below
https://github.com/cefsharp/CefSharp/wiki/Output-files-description-table-(Redistribution)
refered below links in my case not working
CefSharp doesn't run in WIndows 7
Unable to deploy CefSharp application
https://github.com/cefsharp/CefSharp/blob/master/NuGet/Readme.txt#L16
wondering how its working in the visual studio installed system?.in few windows7 system its working and not working in same windows 7 with vs2015..???
so is there any specific thing needs to be installed on users system.
Thanks
Dev
After few research i have resolved the issue. while doing the setup project for release or installation.Apart from cefsharp dll we need to add few more supporting files explicitly.find the below images. First images is the checklist you should make sure these are added along. Second image shows how to add.
Thanks
Dev

MySQL connector reference in asp.net applications

I had two applications that was able to run on my local machine in asp.net through visual studio. A webservice and a web forms app. I decided to try and deploy the webservice to my web host online, but it didnt work, so i tried to remove the reference i had to the MySql data connector and then move it to the "bin" folder and re-reference it. This resulted in that my local application broke, and when i tried to undo what i had done, it just remained with the same error. I have tried to uninstall and install various versions of the MySql connector, but without luck. The reference to the MySql connector also got broken in the web forms app, which i didnt delete the reference in, so now neither of them runs.
"Adgang nægtet" means "Access denied".
Here is the error for the webservice
http://pastebin.com/81wuP68j
And here is the error for the web forms app
http://pastebin.com/LVuUy9Yg
Is there any way to start from fresh? I read on a related question, that a guy suggested to reinstall windows, but that isn't a viable option at all.
EDIT: Apparently when i was re-referencing to a new MySql dll file, it was a wrong version of it, so after installing a new one (a second time), and moving it into the bin, and referencing to it, it worked.
Does the shortcut in the Start Menu set the working directory
correctly? (I suspect that this is the most likely answer)
Is there a different/incorrect version of MySql.Data.dll installed
in the GAC (Global Assembly Cache)? I've seen this give similar
error messages before.
Set 'Copy To Local' the Mysql.Data.dll reference from properties.
If MySql.Data is a mixed mode (native and managed code) 32 bit DLL.
And you executable specifies "Any CPU". On a 64 bit machine with 64
bit .NET this will fail with error message you got. A solution is to
specify "x86" as target for the executable.

c# .NET application crashes on startup on 1 of 3 machines with System.IO.FileNotFoundException

I am writing an application in C# with Visual Studio 2010 and am close to the end with engineering of my application. For testing i use 3 different machines:
Machine A: Workstation-PC (Intel CPU, Win 7 64Bit, .NET 4.0)
Machine B: Private PC (Intel CPU, Win7 64Bit, .NET 4.0)
Machine C: Labor-PC (AMD64, Win7 64Bit, .NET 4.0)
I want a standalone .exe file for the final version. The application works like a charm on Machines A and B no matter if i run the application in the solution folder or copy it to any directory and run it there. It works always (as it should). But Machine C throws an error, directly on application startup and outputs a "...WERInternalMetadata.xml"-file which says "System.IO.FileNotFoundException":
CLR20r3
myapp.exe
1.0.0.0
53318d78
Testreporter
1.0.0.0
53318d78
5d
f
System.IO.FileNotFoundException
But when I start the application in the solution folder(e.g. ...myapp\bin\x64\Debug), where the *.dll files are contained, the application works perfectly without any problems.
Does this mean, that the program searches for its dependecies in the root directory?
I've already checked the references in code. Furthermore if there were any problems with references, the app would not run on Machine B...
I find it curious that Machines A and B run the program without issues no matter where i place the .exe but Machine C only runs my app properly when placed in specific path....
Maybe the processor plays a role there? Any ideas on how to solve this?
BTW:
How can i build a .exe-file that already contains all dependencies and libraries my application needs. A standalone-exe so to say...
Thank you very much
It looks like the EXE is able to find the necessary DLLs in GAC on machines A and B, but is failing to do so in Machine C. Hence, only the particular path is working.
Please check the GAC.
Also, to embed DLLs into EXEs, refer to this SO thread: Embedding DLLs in a compiled executable
I've found a thread with similar topic, leading me to the solution:
System.IO.FileNotFoundException. Where do I find what path is wrong?
I am using Power Packs, too. When i removed the "Microsoft.VisualBasic.PowerPacks.Vs.dll" from the solution directory and started the application, my program failed with the descripted error. Copying back, then starting the application again was successful. So I guess my the target machine (machine C) needs a Power Pack Installation.
So I guess I can solve this problem in 4 ways?:
1.) Leaving the "Microsoft.VisualBasic.PowerPacks.Vs.dll" with the .exe in same folder and then start my application.
2.) Installing the PowerPack http://go.microsoft.com/fwlink/?LinkID=145727&clcid=0x804
3.) Installing the PowerPack.dll manually to the GAC. Or getting them to the GAC with the corresponding tools as described here http://msdn.microsoft.com/en-us/library/yf1d93sz%28v=vs.110%29.aspx
4.) Embed the .dll right into the .exe
Am I right?
Thank you very much for your help!
I had this problem also, with similar entries in Windows->Application logs, including FileNotFoundException. Very disappointed that every app log clue was just a rabbit hole (lack of specific info on WHAT file).
I eventually discovered the error of my wicked ways via Procmon.exe, and scanning through every line marked "NOT FOUND" in the Result column. There was a companion DLL generated as part of the project that I'd forgotten to copy over to the target machine.
If Procmon.exe ever disappears I'll be dead. It has helped to resolve probably 90% of subtle issues encountered since I began using VisualStudio in 1998.
Gave myself a "BoneHead of The Day" award...

Categories

Resources