我如何解决丢失的DLL的例外? dll文件位于

时间:2015-10-03 01:13:59

标签: c# .net winforms dll

这一行:

Boolean bl = InitializeDirectX(mypb);

使用DirectX的InitializeDirectX方法:

public Boolean InitializeDirectX(PictureBox pb)
        {
            DispMode = Manager.Adapters[Manager.Adapters.Default.Adapter].CurrentDisplayMode;
            D3Dpp = new PresentParameters();
            D3Dpp.BackBufferFormat = DispMode.Format;
            D3Dpp.PresentFlag = PresentFlag.LockableBackBuffer;

            D3Dpp.SwapEffect = SwapEffect.Discard;
            D3Dpp.PresentationInterval = PresentInterval.One; //wait for vertical sync. Synchronizes the painting with
            //monitor refresh rate for smoooth animation
            D3Dpp.Windowed = true; //the application has borders

            try
            {
                D3Ddev = new Device(Manager.Adapters.Default.Adapter, DeviceType.Hardware, pb.Handle,
                                                                           CreateFlags.SoftwareVertexProcessing, D3Dpp);
                D3Ddev.VertexFormat = CustomVertex.PositionColored.Format;
                D3Ddev.RenderState.Lighting = false;
                D3Ddev.RenderState.CullMode = Cull.CounterClockwise;

                backTexture = TextureLoader.FromStream(D3Ddev, mymem);
                scannedCloudsTexture = new Texture(D3Ddev, 512, 512, 1, Usage.Dynamic, Format.A8R8G8B8, Pool.Default);

                //sprite is used to draw the texture
                D3Dsprite = new Sprite(D3Ddev);

                return true;
            }
            catch
            {
                return false;
            }
        }

抛出异常:

Boolean bl = InitializeDirectX(mypb);

异常是FileNotFoundException:

A first chance exception of type 'System.IO.FileNotFoundException' occurred in My Weather Station.exe

Additional information: Could not load file or assembly 'Microsoft.DirectX.Direct3DX.dll' or one of its dependencies. The specified module could not be found.

文件Microsoft.DirectX.Direct3DX.dll确实存在于我在参考文件中看到的目录中。我也没有在这个dll的引用中看到任何黄色或文件丢失的状态。

之前我没有例外,就像在dll文件中发生了某些变化一样?

System.IO.FileNotFoundException occurred
  _HResult=-2147024770
  _message=Could not load file or assembly 'Microsoft.DirectX.Direct3DX.dll' or one of its dependencies. The specified module could not be found.
  HResult=-2147024770
  IsTransient=false
  Message=Could not load file or assembly 'Microsoft.DirectX.Direct3DX.dll' or one of its dependencies. The specified module could not be found.
  Source=My Weather Station
  FileName=Microsoft.DirectX.Direct3DX.dll
  FusionLog=""
  StackTrace:
       at mws.ScanningClouds.InitializeDirectX(PictureBox pb)
       at mws.ScanningClouds.ScanClouds_Load(Object sender, EventArgs e) in d:\C-Sharp\myprog.cs:line 179
  InnerException:

第179行是:

Boolean bl = InitializeDirectX(mypb);

如果dll中的某些依赖项缺失不确定原因,我怎么能找到哪些依赖项?如果有的话?

UDATE:

这是文件DirectXDirect3DX.dll

的dotPeek中的引用

dotPeek Reference

在我的项目中:

Reference in project

我不理解T.S解决方案中的记事本部分。

更新

这是我的项目文件中的引用:

<Reference Include="AviFile">
      <HintPath>C:\Temp\avifilewrapper\aviFileWrapperDemo_src\AviDemo\bin\Debug\AviFile.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.DirectX, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>C:\Temp\radarscan\dlls\DLL'S\Microsoft.DirectX.DLL</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="Microsoft.DirectX.Direct3D, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>C:\Temp\radarscan\dlls\DLL'S\Microsoft.DirectX.Direct3D.DLL</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="Microsoft.DirectX.Direct3DX, Version=1.0.2909.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>C:\Temp\radarscan\dlls\DLL'S\Microsoft.DirectX.Direct3DX.DLL</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="NumericComparer">
      <HintPath>C:\Temp\csnsort\csnsort_src\NumericComparer.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Core">
      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    </Reference>
    <Reference Include="System.Speech" />
    <Reference Include="System.Web" />
    <Reference Include="System.Xml.Linq">
      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    </Reference>
    <Reference Include="System.Data.DataSetExtensions">
      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    </Reference>
    <Reference Include="System.Data" />
    <Reference Include="System.Deployment" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
    <Reference Include="unfreez_wrapper, Version=1.0.4362.38939, Culture=neutral, processorArchitecture=x86">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\..\New folder\Unfreez\unfreez_wrapper\Release\unfreez_wrapper.dll</HintPath>
    </Reference>
    <Reference Include="ZedGraph">
      <HintPath>..\..\..\..\Appz\zedgraph_dll_v515_1\zedgraph_dll_v515\zedgraph_dll_v5.1.5\ZedGraph.dll</HintPath>
    </Reference>
    <Reference Include="ZedGraph.Web">

1 个答案:

答案 0 :(得分:0)

您的计算机上可能未安装Directx的组件或部分。在您的计算机上安装DirectX可以解决问题。

相关问题