我正在使用nant构建一个Windows应用程序,当运行rebuild命令来清理当前构建并创建新的程序集文件时,我在命令提示符中收到以下错误:
这是LxSqlCeOprn.cs的一部分,其中包含第85行,其中发生错误:
using System.Data.SqlServerCe;
public static void RepairDb (string fileSpec, bool delCorruptRows)
{
RepairOption opt = delCorruptRows ? RepairOption.DeleteCorruptedRows : RepairOption.RecoverAllPossibleRows;
//System.Data.SqlServerCe.RepairOption opt = new System.Data.SqlServerCe.RepairOption();
//opt = delCorruptRows ? RepairOption.DeleteCorruptedRows : RepairOption.RecoverAllPossibleRows;
try
{
LxNformTools.StopService ();
char[] delimiter = {'.'};
string[] temp = fileSpec.Split(delimiter);
string fileBackup = temp[0] + "tempBak." + temp[1];
File.Copy(fileSpec, fileBackup, true);
SqlCeEngine engine = GetEngine (fileBackup);
LxSystemLogger.Log ("Repairing SQL CE database: " +
engine.LocalConnectionString +
"RepairOption=" + opt,
LxSeverity.Info, "LxSqlCeOprn.RepairDb");
//Attmpt to repair file only if Verify fails
if(!engine.Verify(VerifyOption.Enhanced))
{
engine.Repair (null, opt);
if(engine.Verify(VerifyOption.Enhanced))
{
File.Copy(fileBackup, fileSpec, true);
}
}
File.Delete(fileBackup);
LxSystemLogger.Log ("Repair complete.",
LxSeverity.Success, "LxSqlCeOprn.RepairDb");
}
catch (Exception e)
{
LxSystemLogger.Log ("Error in database operation", e,
"LxSqlCeOprn.RepairDb");
if (LxBaseException.IsCriticalException(e)) throw;
}
return;
} // end RepairDb
我正在使用visual studio professional 2013,对System.Data.SqlServerCe.dll的引用已添加到项目中,Visual Studio不会抱怨任何缺少的定义。我认为这可能与环境设置有关,任何提示都将受到赞赏。