Sqlite EF6註冊

來源:互聯網
上載者:User

標籤:

在EF6使用Sqlite的時候。Sqlite需要安裝sqlite-netFx40-setup-bundle-x64-2010-1.0.97.0.exe。我不想在項目發布的時候,安裝的時候執行該程式,於是看到了打包過程中,Sqlite安裝程式實際是執行的註冊,於是分析了執行的命令提示介面。發現只對三個dll使用C:\Windows\Microsoft.NET\Framework\v4.0.30319\Ngen.exe 執行註冊。

於是使用C#程式執行註冊即可。

            Console.WriteLine("正在添加註冊表項...");
            RegistryKey key = Registry.LocalMachine;
            RegistryKey software = key.CreateSubKey(@"SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx");
       //註冊EF string executeFile = @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Ngen.exe"; string[] dllNames = new string[]{ @"System.Data.SQLite.Linq.dll" ,//1 @"System.Data.SQLite.EF6.dll",//2 @"System.Data.SQLite.dll" }; //執行註冊 for (int i = 0; i < dllNames.Length; i++) { //構建註冊語句 string installCommand = string.Format("{0} {1}{2}{3}", "install", (char)34, dllNames[i],(char)34); Process installProcess = Process.Start(executeFile, installCommand); Console.WriteLine("正在註冊{0},請等待...", dllNames[i]); installProcess.WaitForExit(); }


Sqlite EF6註冊

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.