2010-04-19 2 views
3

내 C# 프로젝트에 SQLite는 (SQLite.NET)를 추가하는 방법 :나는 설명서의 지침을 따라

시나리오 1 : 버전 독립적 인 (전역 어셈블리 캐시를 사용하지 않습니다)

이 방법을 사용하면 버전의 System.Data.SQLite.DLL 을 응용 프로그램의 폴더에 넣고 코드를 수정하거나 을 다시 컴파일하지 않고 을 사용할 수 있습니다. 당신의 app.config 파일에 다음 코드 를 추가

<configuration> 
    <system.data> 
    <DbProviderFactories> 
     <remove invariant="System.Data.SQLite"/> 
     <add name="SQLite Data Provider" invariant="System.Data.SQLite" 
      description=".Net Framework Data Provider for SQLite"   type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /> 
    </DbProviderFactories> 
    </system.data> 
</configuration> 

내 app.config 파일은 이제 다음과 같습니다

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <configSections> 
     <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > 
      <section name="DataFeed.DataFeedSettings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> 
     </sectionGroup> 
    </configSections> 
    <userSettings> 
     <DataFeed.DataFeedSettings> 
      <setting name="eodData" serializeAs="String"> 
       <value>False</value> 
      </setting> 
     </DataFeed.DataFeedSettings> 
    </userSettings> 
    <system.data> 
     <DbProviderFactories> 
     <remove invariant="System.Data.SQLite"/> 
     <add name="SQLite Data Provider" 
      invariant="System.Data.SQLite" 
      description=".Net Framework Data Provider for SQLite" 
      type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /> 
     </DbProviderFactories> 
    </system.data> 
</configuration> 

내 프로젝트 "의 datafeed"라고합니다 :

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Data.SQLite; //<-- Causes compiler error 

namespace DataFeed 
{ 
    class Program 
    { 
     static void Main(string[] args) 
     { 
     } 
    } 
} 

오류는 다음과 같습니다.

\ DEV \의 datafeed Program.cs \ (5,19). 오류 CS0234 : 'SQLite는'이 네임 스페이스 'System.Data'에 존재하지 않는 이름 (있는 형식 또는 네임 스페이스 당신 어셈블리 누락 참조?)

나는 해요 GAC 그래서 난 단순히 내 .\dev\DataFeed\ 폴더에 System.Data.SQLite.dll를 떨어 사용하지 않으. 필자는 문서에서 언급 한 것처럼 DLL을 프로젝트 폴더에 추가하는 것으로 생각했지만 라이브러리를 사용할 수는 없다고 생각했습니다. 실제로이 작업을 수행하는 방법에 대한 힌트가 있습니까?

답변

3

.\Dev\DataFeed 폴더에 DLL을 놓은 다음 프로젝트에 해당 DLL에 대한 참조를 추가 했습니까 ?? 당신이 얻은 오류는 DLL에 대한 레퍼런스 설정이 없다는 것을 의미하는 것 같습니다 - 이것은 그 자체로는 일어나지 않을 것입니다. 당신이 그것을 사용하기 원한다면 외부 DLL에 대한 참조를 수동으로 추가해야합니다.

+0

Doh! 웃음, 나는 실패한다! 도움을 주셔서 감사합니다 ... 지금 작동 중입니다! – Kiril

+0

@Lirik : 때때로 그것은 당신의 방식으로 들어가고 당신 자신이 그것을 볼 수없는 간단한 것들입니다 :-) 거기에 있었고, 경험했습니다 .... –

+0

나는 그것이 1:00에 일어난다 고 생각합니다. :) ... 두뇌는 잠자는 것에 대해 생각하기 시작하고 나는 개발에 대해 생각하라고 여전히 요청하고 있습니다. – Kiril

관련 문제