C# 32位系统与64位系统调用不同的DLL文件



            string dll32 = System.Windows.Forms.Application.StartupPath + @"\System.Data.SQLite-32.DLL";
            string dll64 = System.Windows.Forms.Application.StartupPath + @"\System.Data.SQLite-64.DLL";
            string dllpath = System.Windows.Forms.Application.StartupPath + @"\System.Data.SQLite.dll";
            string systemtype = string.Empty;
            systemtype = Detect32or64();
            if (systemtype == "32" || systemtype == string.Empty)
            {
                try
                {
                    using (FileStream fs = File.Create(dllpath)) {; }
                    File.Copy(dll32, dllpath, true);
                }
                catch
                {
                    ;
                }
            }
            else if (systemtype == "64")
            {
                try
                {
                    using (FileStream fs = File.Create(dllpath)) { }
                    File.Copy(dll64, dllpath, true);
                }
                catch
                {
                    ;
                }
            }

 

 

 

 

private static string Detect32or64()
        {
            switch (IntPtr.Size)
            {
                case 8:
                    return "64";
                default:
                    return "32";
            }
        }


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM