第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

.NET Standard 類庫(kù)無法加載文件或程序集 Microsoft.Data.Sqlite

.NET Standard 類庫(kù)無法加載文件或程序集 Microsoft.Data.Sqlite

C#
泛舟湖上清波郎朗 2022-01-09 15:22:31
我正在嘗試創(chuàng)建一個(gè)訪問 SQLite 數(shù)據(jù)庫(kù)的 .NET Standard 類庫(kù)。經(jīng)過大量研究,我認(rèn)為 Microsoft.Data.Sqlite 效果最好。但是在調(diào)用需要包的類庫(kù)方法時(shí)出現(xiàn)以下異常:無法加載文件或程序集 'Microsoft.Data.Sqlite, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' 或其依賴項(xiàng)之一。該系統(tǒng)找不到指定的文件。我已經(jīng)在一個(gè)非常簡(jiǎn)單的控制臺(tái)應(yīng)用程序中隔離了這個(gè)問題,該應(yīng)用程序使用 .NET Framework 4.6.2 調(diào)用 .NET Standard 2.0 類庫(kù)中的方法。我使用 NuGet 包管理器將 Microsoft.Data.Sqlite 2.1.0 添加到類庫(kù)中。我在 Windows 10 上使用 Visual Studio Community 2017(版本 15.8.3)。在創(chuàng)建直接使用 Microsoft.Data.Sqlite 的 .NET Core 2.1 控制臺(tái)應(yīng)用程序時(shí)我沒有遇到任何問題(也就是說,沒有單獨(dú)的 .NET Standard 類庫(kù))。這個(gè)問題的上下文是我正在嘗試為 Windows 和 Mac 創(chuàng)建一個(gè)桌面應(yīng)用程序。我希望創(chuàng)建一個(gè) .NET Standard 類庫(kù)來處理數(shù)據(jù)訪問,使用 SQLite 作為實(shí)際數(shù)據(jù)庫(kù)。我愿意接受其他建議。
查看完整描述

2 回答

?
拉丁的傳說

TA貢獻(xiàn)1789條經(jīng)驗(yàn) 獲得超8個(gè)贊

這似乎是 Visual Studio和Microsoft.Data.Sqlite 包中的錯(cuò)誤


我有一個(gè)類庫(kù)


<Project Sdk="Microsoft.NET.Sdk">


  <PropertyGroup>

    <TargetFramework>netstandard2.0</TargetFramework>

  </PropertyGroup>


  <ItemGroup>

    <PackageReference Include="Microsoft.Data.Sqlite" Version="2.1.0" />

  </ItemGroup>


</Project>

和3個(gè)引用這個(gè)類庫(kù)的項(xiàng)目文件


第一的:


<?xml version="1.0" encoding="utf-8"?>

<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />

  <PropertyGroup>

    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>

    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>

    <ProjectGuid>{8DA91D88-9D79-4F06-BEA4-00C408542D4F}</ProjectGuid>

    <OutputType>Exe</OutputType>

    <RootNamespace>ConsoleApp3</RootNamespace>

    <AssemblyName>ConsoleApp3</AssemblyName>

    <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>

    <FileAlignment>512</FileAlignment>

    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

    <Deterministic>true</Deterministic>

  </PropertyGroup>

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

    <PlatformTarget>AnyCPU</PlatformTarget>

    <DebugSymbols>true</DebugSymbols>

    <DebugType>full</DebugType>

    <Optimize>false</Optimize>

    <OutputPath>bin\Debug\</OutputPath>

    <DefineConstants>DEBUG;TRACE</DefineConstants>

    <ErrorReport>prompt</ErrorReport>

    <WarningLevel>4</WarningLevel>

  </PropertyGroup>

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">

    <PlatformTarget>AnyCPU</PlatformTarget>

    <DebugType>pdbonly</DebugType>

    <Optimize>true</Optimize>

    <OutputPath>bin\Release\</OutputPath>

    <DefineConstants>TRACE</DefineConstants>

    <ErrorReport>prompt</ErrorReport>

    <WarningLevel>4</WarningLevel>

  </PropertyGroup>

  <ItemGroup>

    <Reference Include="System" />

    <Reference Include="System.Core" />

    <Reference Include="System.Xml.Linq" />

    <Reference Include="System.Data.DataSetExtensions" />

    <Reference Include="Microsoft.CSharp" />

    <Reference Include="System.Data" />

    <Reference Include="System.Net.Http" />

    <Reference Include="System.Xml" />

  </ItemGroup>

  <ItemGroup>

    <Compile Include="Program.cs" />

    <Compile Include="Properties\AssemblyInfo.cs" />

  </ItemGroup>

  <ItemGroup>

    <None Include="App.config" />

  </ItemGroup>

  <ItemGroup>

    <ProjectReference Include="..\ClassLibrary1\ClassLibrary1.csproj">

      <Project>{eb6c148b-91a1-4f10-8703-2b93af5c4de6}</Project>

      <Name>ClassLibrary1</Name>

    </ProjectReference>

  </ItemGroup>

  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

</Project>

第二:


<?xml version="1.0" encoding="utf-8"?>

<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />

  <PropertyGroup>

    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>

    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>

    <ProjectGuid>{292E456C-AD14-452A-8D12-409157D79673}</ProjectGuid>

    <OutputType>Exe</OutputType>

    <RootNamespace>ConsoleApp2</RootNamespace>

    <AssemblyName>ConsoleApp2</AssemblyName>

    <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>

    <FileAlignment>512</FileAlignment>

    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

    <Deterministic>true</Deterministic>

  </PropertyGroup>

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

    <PlatformTarget>AnyCPU</PlatformTarget>

    <DebugSymbols>true</DebugSymbols>

    <DebugType>full</DebugType>

    <Optimize>false</Optimize>

    <OutputPath>bin\Debug\</OutputPath>

    <DefineConstants>DEBUG;TRACE</DefineConstants>

    <ErrorReport>prompt</ErrorReport>

    <WarningLevel>4</WarningLevel>

  </PropertyGroup>

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">

    <PlatformTarget>AnyCPU</PlatformTarget>

    <DebugType>pdbonly</DebugType>

    <Optimize>true</Optimize>

    <OutputPath>bin\Release\</OutputPath>

    <DefineConstants>TRACE</DefineConstants>

    <ErrorReport>prompt</ErrorReport>

    <WarningLevel>4</WarningLevel>

  </PropertyGroup>

  <ItemGroup>

    <Reference Include="System" />

    <Reference Include="System.Core" />

    <Reference Include="System.Xml.Linq" />

    <Reference Include="System.Data.DataSetExtensions" />

    <Reference Include="Microsoft.CSharp" />

    <Reference Include="System.Data" />

    <Reference Include="System.Net.Http" />

    <Reference Include="System.Xml" />

  </ItemGroup>

  <ItemGroup>

    <Compile Include="Program.cs" />

    <Compile Include="Properties\AssemblyInfo.cs" />

  </ItemGroup>

  <ItemGroup>

    <None Include="App.config" />

  </ItemGroup>

  <ItemGroup>

    <ProjectReference Include="..\ClassLibrary1\ClassLibrary1.csproj">

      <Project>{eb6c148b-91a1-4f10-8703-2b93af5c4de6}</Project>

      <Name>ClassLibrary1</Name>

    </ProjectReference>

  </ItemGroup>

  <ItemGroup>

    <PackageReference Include="Newtonsoft.Json">

      <Version>11.0.2</Version>

    </PackageReference>

  </ItemGroup>

  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

</Project>

第三:


<?xml version="1.0" encoding="utf-8"?>

<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />

  <PropertyGroup>

    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>

    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>

    <ProjectGuid>{FBE757BF-025E-4167-90D0-EAD60E50C7EB}</ProjectGuid>

    <OutputType>Exe</OutputType>

    <RootNamespace>ConsoleApp1</RootNamespace>

    <AssemblyName>ConsoleApp1</AssemblyName>

    <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>

    <FileAlignment>512</FileAlignment>

    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

    <Deterministic>true</Deterministic>

  </PropertyGroup>

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

    <PlatformTarget>AnyCPU</PlatformTarget>

    <DebugSymbols>true</DebugSymbols>

    <DebugType>full</DebugType>

    <Optimize>false</Optimize>

    <OutputPath>bin\Debug\</OutputPath>

    <DefineConstants>DEBUG;TRACE</DefineConstants>

    <ErrorReport>prompt</ErrorReport>

    <WarningLevel>4</WarningLevel>

  </PropertyGroup>

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">

    <PlatformTarget>AnyCPU</PlatformTarget>

    <DebugType>pdbonly</DebugType>

    <Optimize>true</Optimize>

    <OutputPath>bin\Release\</OutputPath>

    <DefineConstants>TRACE</DefineConstants>

    <ErrorReport>prompt</ErrorReport>

    <WarningLevel>4</WarningLevel>

  </PropertyGroup>

  <ItemGroup>

    <Reference Include="System" />

    <Reference Include="System.Core" />

    <Reference Include="System.Xml.Linq" />

    <Reference Include="System.Data.DataSetExtensions" />

    <Reference Include="Microsoft.CSharp" />

    <Reference Include="System.Data" />

    <Reference Include="System.Net.Http" />

    <Reference Include="System.Xml" />

  </ItemGroup>

  <ItemGroup>

    <Compile Include="Program.cs" />

    <Compile Include="Properties\AssemblyInfo.cs" />

  </ItemGroup>

  <ItemGroup>

    <None Include="App.config" />

  </ItemGroup>

  <ItemGroup>

    <ProjectReference Include="..\ClassLibrary1\ClassLibrary1.csproj">

      <Project>{eb6c148b-91a1-4f10-8703-2b93af5c4de6}</Project>

      <Name>ClassLibrary1</Name>

    </ProjectReference>

  </ItemGroup>

  <ItemGroup>

    <PackageReference Include="Microsoft.Data.Sqlite">

      <Version>2.1.0</Version>

    </PackageReference>

    <PackageReference Include="Newtonsoft.Json">

      <Version>11.0.2</Version>

    </PackageReference>

  </ItemGroup>

  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

</Project>

  • 如您所寫,第一個(gè)項(xiàng)目沒有找到Microsoft.Data.Sqlite.dll。

  • 第二個(gè)項(xiàng)目將找到Microsoft.Data.Sqlite.dll但是缺少一些e_sqlite3.dll文件

  • 第三個(gè)項(xiàng)目將運(yùn)行良好。

這三個(gè)項(xiàng)目的區(qū)別:

  • Project1引用ClassLibrary1

  • Project2引用ClassLibrary1和 NuGet NewtonSoft.Json

  • Project3引用ClassLibrary1和 NuGet NewtonSoft.JsonMicrosoft.Dara.Sqlite

NewtonSoft.Json - 只要您引用了 NuGet 包并使用PackageReference ,就可以使用任何 NuGet 包)。

VS 錯(cuò)誤

如果您沒有通過 PackageReference 添加對(duì)任何 NuGet 包的引用,則項(xiàng)目將不包含來自所包含項(xiàng)目的任何 NuGet 包引用

Microsoft.Data.Sqlite

需要的文件 x64/x86 e_sqlite3.dll 文件只有在應(yīng)用項(xiàng)目直接引用包時(shí)才會(huì)被復(fù)制。


查看完整回答
反對(duì) 回復(fù) 2022-01-09
?
慕村225694

TA貢獻(xiàn)1880條經(jīng)驗(yàn) 獲得超4個(gè)贊

我剛剛通過明確添加它來工作

<PackageReference Include="Microsoft.Data.Sqlite" Version="$(MicrosoftDataSqliteVersion)" />

到對(duì)您的原始項(xiàng)目有引用的基礎(chǔ)項(xiàng)目。Microsoft.Data.Sqlite 現(xiàn)在被正確引用


查看完整回答
反對(duì) 回復(fù) 2022-01-09
  • 2 回答
  • 0 關(guān)注
  • 552 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)