System.IO.FileNotFoundException - c#

This one is a long story: i have recently built a win32 application in Visual Studio that uses DirectX and I sent it to some friends to verify that it works on other machines. They all had .NET installed, but the app didn't worked for all of my friends.
In two cases there we're some "could not load file or assembly Microsoft.DirectX.DirectInput version 1.0.29..." errors when they tried to run the program.
I figured that they must have other versions of the .dll and, after some checking, i found out that my references we're to fixed versions. I changed the "fixed version" property to false to all of the directX dlls, but they still got errors when they tried to run the application.
Finally i tried to copy all the dlls in the same folder with the app and the directx errors were gone, but they instead got a "System.IO.FileNotFoundException the specified module could not be found" error at the line where the program tried to make a Direct3D.Texture from an image (the link to the image was correct).
If you can help me with hints for fixing any of the problems above, i would greatly appreciate it!

It looks like you're using Managed DirectX, and some of your friends probably don't have it installed. As far as I can tell, the redistributable package for MDX is not available anymore. (Not from Microsoft anyway, you might be able to find it somewhere)
Note that Managed DirectX is basically obsolete and in many cases XNA is a better choice.

If you're using ManagedDirectX than there's the Quick and Dirty way of fixing this problem. and thats just copying the ManagedDirectX dll's into the same directory. MS Says it won't work and it's definitely not very suitable for production envs. But it'll work in most cases.
DLL's are at least:
Microsoft.DirectX.Direct3D.dll
Microsoft.DirectX.Direct3DX.dll
Microsoft.DirectX.dll

Your issue might be resolved by now.
I too was experiencing the same issue for 2 days now and I finally resolved it. I tried out so many solutions that were suggested on the web but nothing worked for me. My project references another project which in turn was referencing Microsoft.DirectX.Direct3DX.dll. When I ran the project I got the exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.DirectX.Direct3DX.DLL' or one of its dependencies. The specified module could not be found.
It turns out that this dll was searching for 'one of its dependencies' and couldn't find them since I didn't have DirectX installed on my machine. So the solution for me was to install DirectX.
Refer the following link for DirectX web installer:
http://www.microsoft.com/en-in/download/details.aspx?id=35
I hope this helps others who face the same problem! :)

Related

Rider redirects to online MSDN documentation -- can I get offline comments for C#?

I am working on a Unity project (idk if that's relevant), but very often whenever I try to view a quick documentation popup in JetBrains Rider with CtrlQ the popup contains only the link to the online learn.microsoft.com page without providing any sensible inline help. This really hinders my workflow and forces me to make mental context switches.
Is this really the whole content of quick documentation that is available for those elements or is something broken on my side? Is their documentation reaaaaally that scarce? I thought that some basic doc for Enumerable.<LINQ queries> or Regex.* would be present...
(#EDIT even simple things like Console.WriteLine() are missing inline docs...)
Can I get the offline MSDN documentation that would be displayed in this popup?
Could it be a problem with my mono/dotnet installation, and if so how can I fix it?
IMPORTANT: I'm on Ubuntu 20.04 and using Rider 2021.3.2. I've also installed the documentation module for my unity editor instance, but I doubt it comes with MSDN included.
#UPDATE: It seems to be a unity/assembly problem, as plain C# projects do have inline documentation hints, only projects generated by unity are missing them. I tried reinstalling unity editor instance from the hub, but the documentation is still missing.
It turns out it is a Unity problem. I Managed to fix that (but it's hacky) using this unity forum thread as a reference and this bug report. I located the netstandard.xml files across my system (locate netstandard.xml command on Linux) and put it under /.../Unity/Editor/2021.2.8f1/Editor/Data/NetStandard/ref/2.1.0/netstandard.xml. (previously there was only a netstandard.dll with no xml file there).
Why isn't this shipped with the unity itself is beyond me. I had luck because I could easily find the location of my dotnet-sdk files on my machine.
If someone has other working and less hacky solution, I am happy to accept it.
#EDIT seems like unity broke something once again, because this solution no longer works... After going to symbol for any thing (e.g. ArrayList's Add()), the decompiled sources point to .../Unity/Editor/2022.1.22f1/Editor/Data/UnityReferenceAssemblies/unity-4.8-api/*.dll. I guess the "solution" would be to download and place the .xml for each corresponding .dll in this directory...
I don't really know what happened. Did I change the .NET API compatibility level somewhere? Did I change build platform (Mono, IL2CPP) or something? I don't know... (I started using the dynamic keyword which is a .NET 4.0 feature, which possibly upgraded my API Compatibility version to .Net Framework and I now target different dlls). But I shouldn't have to bother in the first place — documentation should be working by default, but we have to deal with unity here, so no surprise it's broken :)
#Edit I got frustrated by this lack of basic functionality and I "fixed" it myself... Here is a tool all of you can use to make this semi-automatic: https://t3st3ro.github.io/packages/unityIntelliSenseFixer/
It comes bundled with xmls that seem to work and a script that links them to automatic directories. Hit me up here or somewhere on my page if you have some improvements...

CLIPS: recent version of CLIPSLib.dll (x64)

Greetings and Salutations,
I am looking to embed CLIPS in a .net application (via C#) and I am using two DLLs; CLIPSNet.dll and CLIPSLib.dll
When I try to run the program, it appears that the CLIPSNet.dll is assimilated successfully, but when it reaches to the CLIPSLib.dll, I get errors complaining about the architecture the DLL was compiled in (x86 instead of the expected x64).
I found several threads from several years ago that usually ended with the suggestion to recompile the source and it will work fine.
I do not have the facilities to recompile the source code myself, and a colleague of mine tried to do it for me and he encountered numerous errors in the source.
If anyone in the community has successfully recompiled the CLIPSLib.dll in the x64 architecture, could I impose upon you to please provide a link to the DLL or please email it to me?
Thank you very much, in advance!
Cheers,
Chief_Ed

Can no longer build an old project in Xamarin

I have an old project that used to build
However I have recently tried rebuilding since a xamarin update it and I get an error message
The name 'Build' does not exist within the current context.
I've tried building it with different versions of the .net framework
but none of these have worked.
I have also noticed the warning message
Warning MSB3276: Found conflicts between different versions of the
same dependent assembly. Please set the "AutoGenerateBindingRedirects"
property to true in the project file.
It looks like I might be building it with the wrong assembly version.
EDIT
I've checked the GTK version and there is only one option in my case.
Version 2.12
EDIT
I've just tried restoring my code from version control.
My project will build! ... But I have not really fixed the problem since I get the following runtime error.
System.DllNotFoundException: Unable to load DLL 'libgtk-win32-2.0-0.dll': The specified procedure could not be found. (Exception from HRESULT: 0x8007007F)
Which tells me that I haven't built it with libgtk-win32-2.0-0.dll.
EDIT
I've just created a simple test program after reinstalling Xamarin
When I built it the first time I get the same message about "AutoGenerateBindingRedirects"
When I built it again I get a different error message.
System.DllNotFoundException
I'm back to not being able to find libgtk
I have finally got it working. Here's what I did
I uninstalled all xamarin, mono and GTK programs from windows using the windows control panel.
Removed all registry entries I could find.
Manually deleted the remaining program files from my hard drive.
Went and downloaded the latest versions of GTK and mono and .net. Reinstalled and rebooted.
Copied the gtk files into my program directory and everything worked.
I'm not sure which of these steps may have helped.

Can't Find DLL (Visual Studio 2008)

Right now I'm trying to write a program for a sensor to collect data with. The sensor manufacturer released an SDK that has example code in it. I haven't made any changes to the code and am only attempting to use their examples to figure out how to make my own code work with the sensor. I've opened it up with Visual Studio 2008 and attempted to run the code as both debug and release. In both cases, it stops when it can't find the manufacturer's dll files.
I've copied the files in question to the same folder with the project in it and the problem persists. I've been to multiple forums and downloaded things and nothing has worked. I've run Dependency Walker which indicated issues with ieframe.dll and ieshims.dll. I copied both files from the IE folder and into the system32 folder and then registered them with an elevated command prompt. This fixed the issue with ieshims but ieframe persists. I tried downloading the latest IE (11) but that just introduced more issues and failed to fix the ieframe issue.
I'm not really sure how to proceed and any help would be appreciated.
The dll needs to be in the same folder as the executable. I use a shortcut/link within VS to achieve this. The result looks like this:
See this post for more details and an example.
Are you getting other errors besides the .DLL errors? If so, you need to get ride of those errors. Once you get rid of those errors your DLL errors should go away then.

Visual Studio 2010 suddenly can't see namespace?

My C# WinForms solution has two projects.
A DLL which is the main project I'm working on, and an executable WinForms I call "Sandbox" so that I can compile/run/debug the DLL easily in one go.
I'm working in .Net 4.0 for both projects.
Everything was working fine until I added some seemingly innocent code, and a reference to System.Web in the DLL.
Now my Sandbox project can't see the namespace of the DLL project. I didn't change anything which I believe should have affected this.
If I delete the project reference to the DLL from the Sandbox references and re-add it, then the red underlines all disappear and the colour coding comes back for all my classes etc; but as as soon as I try to build the solution, the whole thing falls apart again.
When I right-click the DLL project in the Sandbox's references and view in object browser, I can see the namespace and all the stuff in there.
I have a feeling this might be some sort of bug?
Is this some sort of VS2010 bug? I had this same issue a few months ago and I could only fix it at the time by making a whole new project and re-importing my files. This time, however, I have a bajillion files and will only do that as a last resort!
Edit:
After panickedly going through and undoing all my changes, trying to find what caused the problems, it seems to be this line:
string url = "http://maps.google.com?q=" + HttpUtility.UrlEncode(address);
If I comment out this line, then I get no namespace errors and the project builds fine. I can't see anything wrong with this line though.
I'm ready to declare this a bug in VS2010, this has bitten way too many programmers already. The fix is easy: Project + Properties, Application tab, change Target Framework to ".NET Framework 4" instead of the Client Profile that is selected by default.
System.Web is not included in the client profile. Having this option in the first place is quite silly, the client profile is only 15% smaller than the full version of .NET 4.0. Having it selected by default is even sillier. But I digress.
UPDATE: mercifully this all got fixed in VS2012. Which no longer makes the client profile the default for a new project. And the client profile got retired completely in .NET 4.5, good riddance.
Check to make sure that both projects are using the non-client profile for their target framework (go to each project's properties to do this).
One possibility is that the target .NET Framework version of the class library is higher than that of the project.
I faced this problem, and I solved it by closing visual studio, reopening visual studio, cleaning and rebuilding the solution. This worked for me. On some other posts, I have read the replies and most of users solved the problem by following this way.
Try building only the project with the Sandbox dll first independently.
Then point your executable project to the required dll and ensure copy local is set to true. in reference settings.
Tthen build the executable project.
Changing the target framework from the ".NET Framweork 4 Client Profile" to ".NET Framework 4" worked for me with a similar problem. I agree that the client profile doesn't seem to have much of an advantage to using it. I seem to get nailed with weird errors that I hunt for until I remember that Visual Studio defaults to the client profile. I guess the moral of the story when getting an error is: if "Rebuild Solution" doesn't work, check the Target framework...
If you tried already doing the Framework change, and still not worked, I hope this works for you (as it did for me): Simply add the necessary references from within your projects. Very obvious but I was doing it wrong until I found what was the issue.
I just had this issue and it turned out to be I had multiple namespaces being used that had the same object name (i.e. business objects had the same names as mvc models);
Fully qualifying the names fixed the issue for me.

Categories

Resources