Not found or missing file - c#

I am working on a cross platform Gui app using c# Visual Studio on Windows. I was hoping to port my code to linux via Monodevelop because i have tried it with another project and it worked.
However in this particular project I happen to use EasyTabs dll to create a chrome tabs on my app. The projects is error free on windows but on linux i get a dll exception error and one dll it says is missing is that of uxtheme.dll
I have tried to copy the uxtheme dll from my windows C:\Windows\System32
To my project and add it to my .csproj and even copied it to my debug and release folder. However this has not been successful. Any workable idea would do.

it looks like you are trying to run a winapi project on linux. While Monodevelop may look like it support windows envirnonment on linux os it is very important to note that not all dll and supportive windows runtime files are available. You have to look for missing dll files to fix your problem or simply write a program that does not require them at all

Related

monodevelop - working debug but not working release

I have developed a project with VS on Windows 10. Right now on Linux mint i am debugging the project with MonoDevelop and it runs just fine.
Let me show you:
However when i make a build and i go to the Release folder and then i try from the terminal to launch the program i have a problem. Let me show you first the files i have build:
Then i go to the directory with my terminal and i run:
chmod +x ./WorldServer.exe then i run ./WorldServer.exe
and i receive the following error:
I know that this is .exe file and maybe i have to build a different type of file. But i am not really sure what setting should i apply in my project to make a working build for linux.
As far as i know linux is using .so as extension for it's libraries. However it is generating .dll files. Can i change that? Can i somehow make my project to be "buildable" in the two OS Linux and Windows ?
The exception tells us, you need System.Management in your project. It isn't there.
Why?
Because Mono, according to there Road-map, doesn't support this:
The following do not map to operating systems other than Windows, and
we are unlikely to spend time to support them even on Windows:
System.Management
How?
System.Management is a library that only works on Windows. The MySQL connector driver has started to depend on this library and tries to load it per reflection.
I'm not into this whole MySql Progess but there is an open bug for it. Also there is a comment which says:
The last working version of the MySQL .NET Driver is 6.4.6
I hope this helps you.

How do I link to external DLL so that it will be recognized by Windows 8.1?

I developed WindowsForm application using C# with Visual Studio 2010, and I have external DLL (written using VC++). When I deployed it to Windows 7, everything works fine. However, on Windows 8.1, it installed fine and run fine, until the program needed to access the library function inside the DLL. It complained that it couldn't find the DLL (even though the file is in the same location as the executable).
This happened in Windows 8.1 only (perhaps with Windows 8 as well).
Did I link the DLL incorrectly perhaps?
Assuming that your DLL is a windows native DLL, one of two things is happening:
Windows is failing to locate the DLL
The DLL has other dependencies that are not available on the machine
To check, try changing the PATH environment variable to include the folder that your DLL is in. If the program runs then it's a problem with locating the DLL.
If that doesn't work then you'll need to do some more in-depth investigation to find out what is actually happening.
There's a guide here that shows you how to determine what is happening with your program using Process Monitor to find out what is actually failing to load. This might not be your C++ DLL, it could be one of the many dependencies for it.
The answer is the comment from Harry Johnston above:
Most likely cause: the Visual Studio 2010 Microsoft C runtime isn't installed on the Windows 8.1 machine. Or perhaps the C++ class library. Nothing to do with the OS version, except perhaps indirectly. You can diagnose this sort of problem using Process Monitor, look for file not found errors.

ActiViz.NET.x64 (v5.8.0): Unable to load DLL 'Kitware.VTK.vtkFiltering.Unmanaged.dll'

I'm trying to use the VTK with C# to read and write VTK/VTS files. I created a basic app, and I installed the 64-bit VTK .NET wrapper package which is called ActiViz.NET.x64 (v5.8.0).
The package installed without any problems, and I could access the Kitware.VTK namespace, but as soon as I try to create a VTK object, I got an unmanaged DLL loading error.
An unhandled exception of type 'System.DllNotFoundException' occurred in Kitware.VTK.dll
Additional information: Unable to load DLL 'Kitware.VTK.vtkFiltering.Unmanaged.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
I don't think that the exact code is relevant here, but I got the exception at the following line:
vtkStructuredGrid structuredGrid = vtkStructuredGrid.New();
I'm using Windows 10 x64, Visual Studio 2015, the target .NET Framework is 4.6.2 and I have ParaView 4.1 and 5.2 installed. The DLL in question is in the bin directory of the app, but I also tried to copy it to the Windows/System32 directory, the result is the same.
Is there a way to figure out what exactly the problem is with the dll loading?
If you go to the ActiViz product page you can see the following in the FAQ:
Does ActiViz 64 work with Visual Studio?
Visual Studio is a 32 bits
application, therefore 64 bits control does not work and you need the
32 bits version of ActiViz when using the designer within Visual
Studio. Usually, the 32 bits version is used to design and the 64 bits
version is used for the final compilation.
I also use VTK/ActiViz (C#) on Visual Studio, and it works fine when my program is targeting x86 platforms. However, if I target x64 platforms, the winforms control for the render window disappears, but I can still build the executable. So do this:
1) Install Activiz.NET.x86 from NuGet & target x86 platforms;
2) Create and debug your App;
3) Make a backup of the solution folder;
4) Install Activiz.NET.x64 from NuGet & target x64 platforms;
5) Don't open the designer because it will be buggy (all RenderWindowsControl disappear);
6) Build the solution (Release x64).
So, first I wanted to know where exactly is my process looking for the missing DLL. I used Sysinternals Suite and its Process Monitor.
I referenced VTK in my .NET library which I used in my self-hosted app. The self-hosted app was the start-up project, so the runtime looked for the missing DLL in the app's directory, not the library's, where it actually was.
After I copied the missing Kitware.VTK.vtkFiltering.Unmanaged.dll to that directory, Process Monitor confirmed that the DLL was read successfully, but I still got the same exception as before.
I compared the library's and the app's bin directories, and I figured that only the Kitware.mummy.Runtime.dll and Kitware.VTK.dll were copied there automatically.
I copied all the other VTK DLLs to the app's bin, and then it finally worked.
The exception's error message wasn't detailed in the first place, but I think it is more likely a problem with the ActiViz.NET package.
You should copy all dlls from Activiz Installation bin directory even you don't need to use in your code.
C:\Program Files (x86)\ActiViz.NET 5.8.0 OpenSource Edition\bin
Managed .Net DLL's is a wrapper for unmanaged VTK libraries. Mummy.dll is for this job.

Program works only on some pc, DLL missing?

I wrote with VS10 the following projects:
a C# (.net 4.0) program which calls
a C++ unmanaged dll, which make use of boost::thread
a setup project which includes the C# executable, the C++ dll, the boost::thread dll and some other files. Moreover during the installation there is a check if the framework .net 4.0 is installed, and if not it will be downloaded.
The compilation (x64 for each of the three projects) is ok, and the program works on my pc (Windows 7 64bit).
I tested the program on some other computers (all Windows 7 64bit) and I noted that:
in the ones with VS10 and Boost the program works
in the ones without VS10 and Boost the program gives an error in the C++ Dll
I think the problem is that some boost Dll is missing. Am I right?
Or the problem could be related to VS?
edit:
I have to mention that the structure of the program is the following:
main form (C#) in which some parameters are set, then a backgroudworker calls
the C++ DLL which do its stuff and uses boost::thread
it does some computations
when it get some results, writes them on file
continue with its computations and so on
the main form has a filesystemwatcher which looks for the results file and do some stuff with the results.
Also, when I get the error, the main form correctly loads and the parameters could be set. The error happens when the backgroundworker starts his work (calling the C++ DLL).
So I'm quite sure that there is no problem with the framework installation.
Update:
It turns out that I forgot to include some DLLs in the setup project. Now, including them the error changed.
Now, at the same point as before (and on the same computers) I get another error:
BadImageFormatException: An attempt was made to load a program with an
incorrect format
I read this article, but I have set x64 in both C# project and in C++ DLL and the setup project has as TargetPlatform x64. Any idea?
VCRedist package is missing on target machine. It should be available in VS SDK directory. Also you may need to install .Net Framework on target machine (.Net Framework contains VCRedist package). If you don't have instalation files for those, they are available on microsoft sites i.e. VC10Redist for x64 is here
In such cases I use the tool Dependency Walker
Launch it and select your executable to discover the missing libraries.
It gives clues indicating what is needed to install then.
If your C++ DLL is dynamically linked to the CRT, then you have to deploy also the VC++ CRT DLL's, i.e. MSVCR100.DLL and C++'s MSVCP100.DLL on the target machine (they are already available on your dev machine, where you have VS2010 installed, so on that machine your C++ DLL loads fine; but you can't assume that on your client's machine the CRT/C++ DLL's are available).
There are several deployment options: you may want to read this documentation on MSDN.
I finally found the solution!
The C++ DLL needs the mpfr library for multiple precision floating point computations with correct rounding.
I was including (shame on me!) the incorrect version of the library (x86) and this was the motivation for the error:
BadImageFormatException: An attempt was made to load a program with an incorrect format
Then in all the computers (three different computers!) in which the program was ok there were both (unlucky and misleading coincidence):
Boost and VS10 installed and
a x64 version of the library in a folder contained in the Path environment variable.
So, in some way the program found the right version of the DLL.
Including the right version of the library in the Setup Project fixed the problem.
Thanks to Kamil Klimek, Stephane Rolland and Mr.C64 for their precious suggestions.

Unable to load dll error

i am working project in c# Visual studio 2009,i am using c++ dll in my project and also i call that dll through my function . In my system the project run successfully.but in other system not in single system more than system i checked it shows exception like unable to load dll. i am check that dll in dependency walker it shows msvcr71.dll is missing.how i get this.?i need better solution for this
The problem is that your native C++ DLL depends on the library msvcr71.dll. This is not part of the standard windows installed hence you must take some action to get it onto the target machine.
The simplest way to do this is to just copy the DLL around with your application. The following KB article covers this.
Documentation on msvcr71.dll
http://msdn.microsoft.com/en-us/library/abx4dbyh(VS.71).aspx
You're probably missing something in your installation of the SDK (or Visual Studio). I would recommend a Repair or Reinstall.
look on msdn for info about redistributables - this tell you what you need to install on a non dev box to make things work
This is not programming related. You are missing a dll file on your target system. Download and put in "windows/System32" and it should run.

Categories