2011-02-23 122 views
0

我已經下載.net示例FindPrivateKey,編譯爲框架4.0,嘗試不同的平臺(32位,64位,任何CPU),但它沒有工作。始終存在相同的錯誤:序號345不能位於動態鏈接庫comctl32.dll中。我使用Windows 7 Enterprise,64位版本。 此方法調用失敗:matches = X509Certificate2UI.SelectFromCollection(store.Certificates,「Select certificate」,「Select the certificate to find the location of the private private key file:」,X509SelectionFlag.SingleSelection); 這裏有什麼問題?FindPrivateKey在Windows 7 64位不工作

亞歷山大

回答

1

今天早上我遇到了同樣的問題(序號345找不到...)... 我試過3種不同的PC與Win7的64位應用程序;但只能在其中一個例外拋出。我發現問題在於使用comctl32.dll庫(這與我的不同)。

可以以檢查庫的版本使用的是執行這段代碼:

foreach (ProcessModule module in System.Diagnostics.Process.GetCurrentProcess().Modules) 
      if (module.ModuleName.ToLower() == "comctl32.dll") 
       MessageBox.Show(module.FileVersionInfo.ToString()); 

然後添加一個清單,並強制應用程序使用特定的庫版本: [項目] - >添加新項目 - >應用程序清單 並編輯它添加以下依賴項部分。

我希望這對你的作品...

<?xml version="1.0" encoding="utf-8"?> 
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/> 

… 
… 
… 

    <dependency> 
    <dependentAssembly> 
     <assemblyIdentity 
      type="win32" 
      name="Microsoft.Windows.Common-Controls" 
      version="6.0.0.0" 
      processorArchitecture="*" 
      publicKeyToken="6595b64144ccf1df" 
      language="*" 
     /> 
    </dependentAssembly> 
    </dependency> 
</asmv1:assembly> 
+0

我發現你也可以使用'#pragma'預處理做到這一點。有什麼不同嗎? '#pragma comment(linker,「/ manifestdependency:\」type ='win32'name ='Microsoft.Windows.Common-Controls'version ='6.0.0.0'processorArchitecture ='*'publicKeyToken ='6595b64144ccf1df'language =' *'\ 「」)' – Banderi 2014-11-28 21:33:14

相關問題