簡體   English   中英

最新的SQLite版本錯誤

[英]latest SQLite version errors

剛剛通過Nuget將我的SQLite dll更新為v1.0.81.0,我收到的錯誤如下所示。 首次成功執行一次或多次(不確定)后會發生這種情況。 環境是x64計算機上的vs2010,但是針對x86的構建設置。

我使用SQLite對我的NHibernate映射進行單元測試。 在過去經常發現SQLite有點“胡思亂想”,我不願意弄亂工作單元測試夾具(見下文)

有人知道這里出了什么問題嗎?

干杯,
Berryl

錯誤消息

Unable to copy file "...\x86\SQLite.Interop.dll" to "bin\Debug\x86\SQLite.Interop.dll". The process cannot access the file 'bin\Debug\x86\SQLite.Interop.dll' because it is being used by another process. Parties.Data.Impl.NHib.Tests

單元測試夾具(足以顯示文件訪問權限)

public abstract class SQLiteTestFixture
{

    protected override void BeforeAllTests()
    {
        _configureDbFile();
        base.BeforeAllTests();
    }

    protected override void AfterAllTests()
    {
        base.AfterAllTests();

        _deleteAllDbFiles();
    }

    #region Db File Maintenance

    /// <summary>
    /// Using a file is likely slower than just memory but not noticeably so far,
    /// AND seems to be a bit more stable
    /// </summary>
    private const string DB_FILE_SUFFIX = ".Test.db";

    /// <summary>
    /// Just make some random file name with a known suffix, so we can clean up when done.
    /// </summary>
    private void _configureDbFile()
    {
        _dbFile = Path.GetFullPath(Guid.NewGuid().ToString("N") + DB_FILE_SUFFIX);

        // highly unlikely but just in case the same file is already out there
        _deleteDbFile();
    }

    private void _deleteDbFile()
    {
        if (File.Exists(_dbFile)) File.Delete(_dbFile);
    }

    private static void _deleteAllDbFiles()
    {
        var files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*" + DB_FILE_SUFFIX);
        foreach (var file in files)
        {
            File.Delete(file);
        }
    }

    private string _dbFile;

    #endregion

}

}

我在使用VS2010和TestDriven.Net的SQLite 1.0.88.0時遇到了這個問題。 我嘗試了幾個SO問題的答案,但唯一對我有用的是:

  1. 工具 - >選項 - > TestDriven.Net - >常規
  2. “運行測試 ”下,取消選中“在測試運行之間緩存測試過程”
  3. 重新啟動Visual Studio

您現在應該能夠運行測試,調試測試,重建等,而無需重新啟動進程或Visual Studio。

KB文章描述了一個可能的原因

以下大部分內容暫時解決了問題

將SQLLite dll“復制到輸出目錄”更改為“如果更新則復制”可以解決問題。 (您需要在更改屬性后重新啟動VS)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM