2012-03-17 38 views
0

當使用程序集綁定日誌查看器來檢查是什麼原因造成的FileNotFoundException異常錯誤,當我跑我的C#應用​​程序,我得到了在錯誤日誌文件中的下列操作之一:裝配基準不匹配的組件定義中找到

LOG: Post-policy reference: msvcm90, Version=9.0.30729.4974, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 
    LOG: Did not find assembly in DEVOVERRIDE path C:\Documents and Settings\All Users\Application Data\Red Gate\.NET Reflector\DevPath 
    LOG: GAC Lookup was unsuccessful. 
    LOG: Attempting download of new URL file:///F:/Stuff/Muaz/Programming/C#/Spatial and Temporal Research/Spatial and Temporal Research/bin/Debug/msvcm90.DLL. 
    LOG: Assembly download was successful. Attempting setup of file: F:\Stuff\Muaz\Programming\C#\Spatial and Temporal Research\Spatial and Temporal Research\bin\Debug\msvcm90.dll 
    LOG: Entering run-from-source setup phase. 
    LOG: Assembly Name is: msvcm90, Version=9.0.30729.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 
    WRN: Comparing the assembly name resulted in the mismatch: Revision Number 
    ERR: The assembly reference did not match the assembly definition found. 
    ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated. 

我嘗試使用直接綁定在app.config文件:

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <startup useLegacyV2RuntimeActivationPolicy="true"> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> 
    </startup> 
    <runtime> 
     <assemblyBinding> 
      <dependentAssembly> 
       <assemblyIdentity name="msvcm90" 
            publicKeyToken="b03f5f7f11d50a3a" /> 
       <bindingRedirect oldVersion="9.0.30729.4974" 
           newVersion="9.0.30729.1"/> 
      </dependentAssembly>   
     </assemblyBinding> 
    </runtime> 
</configuration> 

但發生同樣的錯誤。我試圖搜索DLL文件msvcm90,但無法找到版本9.0.30729.4974(也許是因爲它的舊)。任何其他方式來解決這個問題?謝謝。

回答

1

您對VS2008附帶的託管C運行時支持DLL有依賴性。您提供的版本很舊,不屬於您放置的目錄,它需要部署到Windows並行緩存(c:\ windows \ winsxs)中。首先刪除文件,你可能會很幸運。

要做的最好的事情是要求使用此支持DLL的產品或DLL的所有者進行正確的安裝過程。接下來最好的事情是安裝VC++支持運行時庫,您可以下載安裝程序from here。我不知道它是否是正確的版本,自從它發佈以來,已經有很多安全補丁。安裝後運行Windows Update。

+0

謝謝,我在c:\ wondows \ winsxs中找到了dll版本,並將其複製到文件夾中。現在在日誌文件中沒有任何錯誤出現在程序集綁定查看器中,但我仍然收到錯誤:「System.IO.FileNotFoundException:無法加載文件或程序集」Autodesk.Navisworks.Timeliner.dll「或其某個依賴項。模塊找不到。「我張貼在這裏:http://stackoverflow.com/questions/9729691/an-unhandled-exception-of-type-system-io-filenotfoundexception-occurred-in-unk我仍然無法解決。我會盡力像你告訴我一樣運行Windows Update並看到結果 – mj1261829 2012-03-17 07:12:34

+0

像這樣的程序集將會有更多的依賴項超越msvcm90.dll。驗證許可證並與Autodesk聯繫以獲得支持。 – 2012-03-17 07:31:51