安装 SQLite NuGet 包会安装包,但参考不可用.VS2019 社区 [英] Installing SQLite NuGet Package installs the package but the reference is not available. VS2019 Community

查看:124
本文介绍了安装 SQLite NuGet 包会安装包,但参考不可用.VS2019 社区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 SQLite 编写一个 c# 应用程序,我需要 SQLite 参考.使用 NuGet 我找到了包,输出窗口显示安装成功.

查看解决方案资源管理器中的包配置文件,它显示了安装的版本.

但是在解决方案资源管理器中 SQLite 的项目引用下不存在.

我在网上看过教程,在其他机器上完成了同样的过程,一切正常,NuGet 安装完成后弹出所有引用.

我使用的是 VS2019,据我所知,NuGet 的运行方式发生了一些变化,但是我有 VS2015 和 VS2017 社区并且遇到了同样的问题.我真的站在一个立场上,因为我不知道如何让引用显示出来,以便我可以在我的程序中访问它.

SQLite 没有程序集引用,因此无法添加它.

我看过有关 NuGet 配置文件和包配置文件以及包安装在解决方案文件夹之外的可能性的帖子,但我不知道在哪里.我查看了解决方案的输出位置,没有任何引用位于调试文件夹中的任何位置.

我觉得 Dll 安装在解决方案文件夹之外,但我不知道在哪里以及如何让 Visual Studio 将它们带到正确的位置或正确引用现有位置.

重建和恢复 NuGet 包没有提供解决方案.

任何帮助将不胜感激.

解决方案

Installing SQLite NuGet Package 安装包但引用不可用.VS2019 社区

我假设您已经安装了

注意每个文件夹都为安装项目提供特定的功能.而lib文件夹的作用是添加其内容(xxxx.dlls)作为对新项目的引用.一句话,只有lib文件夹中的Dlls才能被nuget识别并添加到Reference中.

您可以参考此链接 了解有关文件夹功能的更多详细信息.

第二Build文件夹中有一个名为SQLite.props的文件.该文件将 在构建过程中对您的项目进行一些配置.

在里面,你可以看到这些文件:

<链接>x64\%(文件名)%(扩展名)</链接><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory><Visible>False</Visible></内容></项目组><ItemGroup Condition=" (Exists('packages.config') Or Exists('packages.$(MSBuildProjectName).config')) And '$(Platform)' == 'x86'"><Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win7-x86\native\*"><链接>%(文件名)%(扩展名)</链接><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory><Visible>False</Visible></内容></项目组><ItemGroup Condition=" (Exists('packages.config') Or Exists('packages.$(MSBuildProjectName).config')) And '$(Platform)' == 'x64'"><Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win7-x64\native\*"><链接>%(文件名)%(扩展名)</链接><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory><Visible>False</Visible></内容>

所以当您构建项目时,SQLite.props 文件将被执行,它们将在构建期间或运行时提供服务.

所有这些都表明它是用于特定执行功能的包,而不是用于向项目添加参考库的 nuget 包.

建议

建议您安装 System.Data.SQLite 在您的项目中.这个 nuget 包在参考中提供了你想要的 dll.

希望能帮到你.

I"m writing a c# application using SQLite and I need the the SQLite Reference. Using NuGet I locate the package and the output window shows a successful install.

Looking at the packages config file in the solution explorer it shows the version installed.

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="SQLite" version="3.13.0" targetFramework="net472" />
</packages>

However under the project References in the Solution explorer SQLite is not there.

I have watched tutorials online where the same process is done on other machines and all is ok, all of the references pop up after NuGet finishes the installation.

I'm using VS2019 and from what I understand there were some changes on how NuGet operates, however I had VS2015 and VS2017 Community and had the same issues. I'm really at a standing point as I have no idea how to get the reference to show up so I can access it in my program.

SQLite has no Assembly reference so adding it there is not an option.

I have seen posts about a NuGet config file and Package Config File as well as the possibility of the package being installed outside of the Solution Folder but I don't know where. I have looked in the output location of the solution and none of the references are located in the debug folder anywhere.

I feel the Dll's are being installed outside of the solution folder but I don't know where and how to get Visual Studio to get them to the proper location or reference there existing location correctly.

Rebuild and Restore NuGet Packages provide no solution.

Any help would be greatly appreciated.

解决方案

Installing SQLite NuGet Package installs the package but the reference is not available. VS2019 Community

I assume you have installed sqlite version 3.13.0 nuget package.If so, it is the behavior of this nuget package. This package is very special in that it is a transactional SQL database engine that implements self-contained, serverless, zero-configuration.

In simple terms, it is a configuration function package that operates on related data when the project is running, rather than a package that provides a reference class library for the project.

Let me explain it in more detail:

This is the content of the nuget package sqlite version 3.13.0

Note that each folder provides specific functionality for the installation project. And the function of the lib folder is to add its content(xxxx.dlls) as reference to a new project. In a word, Only the Dlls in lib folder can be recognized by nuget and added into Reference.

You can refer to this link for more detailed info about the function of the folders.

Second, there is a file called SQLite.props in the Build folder. The file will do some configuration to your project during build process.

In it, you can see these files:

<Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win7-x64\native\*">
      <Link>x64\%(Filename)%(Extension)</Link>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <Visible>False</Visible>
    </Content>
  </ItemGroup>
  <ItemGroup Condition=" (Exists('packages.config') Or Exists('packages.$(MSBuildProjectName).config')) And '$(Platform)' == 'x86'">
    <Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win7-x86\native\*">
      <Link>%(Filename)%(Extension)</Link>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <Visible>False</Visible>
    </Content>
  </ItemGroup>
  <ItemGroup Condition=" (Exists('packages.config') Or Exists('packages.$(MSBuildProjectName).config')) And '$(Platform)' == 'x64'">
    <Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win7-x64\native\*">
      <Link>%(Filename)%(Extension)</Link>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <Visible>False</Visible>
    </Content>

So when you build your project, the SQLite.props file will be executed and they will provide services during build or at the runtime.

All of these indicates it is a package for specific execution functions rather than a nuget package for adding reference libraries to the project.

Suggestion

As a suggestion, you could install System.Data.SQLite in your project. And this nuget package provides the dlls which you want in Reference.

Hope it could help you.

这篇关于安装 SQLite NuGet 包会安装包,但参考不可用.VS2019 社区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆