System.IO.FileNotFoundException
这是一个很长的故事:我最近在 Visual Studio 中构建了一个使用 DirectX 的 win32 应用程序,并将其发送给一些朋友以验证它是否可以在其他计算机上运行。他们都安装了 .NET,但该应用程序并不适合我所有的朋友。
在两种情况下,当他们尝试运行程序时,会出现一些“无法加载文件或程序集 Microsoft.DirectX.DirectInput 版本 1.0.29...”错误。
我认为他们一定有其他版本的 .dll,经过一番检查,我发现我的引用是固定版本。我将所有 directX dll 的“固定版本”属性更改为 false,但在尝试运行应用程序时仍然出现错误。
最后,我尝试将所有 dll 与应用程序复制到同一文件夹中,directx 错误消失了,但在程序尝试执行的行中出现“System.IO.FileNotFoundException 找不到指定的模块”错误从图像制作 Direct3D.Texture (图像的链接是正确的)。
如果您能帮助我提供解决上述任何问题的提示,我将不胜感激!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您似乎正在使用 Managed DirectX,而您的一些朋友可能没有安装它。据我所知,MDX 的可再发行包不再可用。 (无论如何不是来自 Microsoft,您可能可以在某处找到它)
请注意,Managed DirectX 基本上已过时,并且在许多情况下 XNA 是更好的选择。
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.
如果您使用的是 ManagedDirectX,那么有一种快速而肮脏的方法可以解决此问题。这只是将 ManagedDirectX dll 复制到同一目录中。 MS 说它不起作用,而且绝对不太适合生产环境。但在大多数情况下它都会起作用。
DLL 至少是:
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.Direct3DX.dll。当我运行该项目时,出现异常: System.IO.FileNotFoundException:无法加载文件或程序集“Microsoft.DirectX.Direct3DX.DLL”或其依赖项之一。找不到指定的模块。
事实证明,这个 dll 正在搜索“它的依赖项之一”,但找不到它们,因为我的计算机上没有安装 DirectX。所以我的解决方案是安装 DirectX。
请参阅以下链接获取 DirectX Web 安装程序:
http://www.microsoft.com/en-in/download /details.aspx?id=35
我希望这可以帮助其他面临同样问题的人! :)
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! :)