Sqlite EF6注册

在EF6使用Sqlite的时候。Sqlite需要安装sqlite-netFx40-setup-bundle-x64-2010-1.0.97.0.exe。我不想在项目发布的时候,安装的时候执行该程序,于是看到了打包过程中,Sqlite安装程序实际是执行的注册,于是分析了执行的命令提示界面。发现只对三个dll使用C:WindowsMicrosoft.NETFrameworkv4.0.30319Ngen.exe 执行注册。

于是使用C#程序执行注册即可。

            Console.WriteLine("正在添加注册表项...");
            RegistryKey key = Registry.LocalMachine;
            RegistryKey software = key.CreateSubKey(@"SOFTWAREMicrosoft.NETFrameworkv4.0.30319AssemblyFoldersEx");

       //注册EF string executeFile = @"C:WindowsMicrosoft.NETFrameworkv4.0.30319Ngen.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(); }


下载地址

原文地址:https://www.cnblogs.com/LittleJin/p/4929705.html