\bin 中插入不需要的 SQLite

发布于 2024-09-01 08:38:25 字数 432 浏览 10 评论 0原文

我正在使用 Visual Studio 2010 并使用 Web 部署将 .Net MVC 站点提升到特定环境。我安装了 Elmah,它在我的 DEV 环境中运行得很好,但是当我推送 TEST 时,我遇到了异常,因为 SQLite 不是一种好的格式。

我没有在 Elmah 或我所知道的其他方式中使用 SQLite。我已经删除了对 SQLite 的所有可见引用,并且从所有配置 bin 目录中删除了 .dll。但它仍然会在每次构建时插入。我意识到异常问题是 SQLite 无法为 CPU Any 构建,并且我的环境从 x86 到 x64 不等。但我宁愿 SQLite 甚至不存在。

我已经卸载了 Elmah,SQLite 仍然插入到 \bin 目录中。我现在重新安装了 Elmah,并在每次构建后手动从 \bin 中删除 SQLite.dll。我如何确定是什么导致 SQLite 在每次构建后插入到我的 \bin 中?

I am using Visual Studio 2010 and using web deployment to promote the .Net MVC site to specific environments. I installed Elmah, and it worked great on my DEV environment, but when I pushed TEST, I got exceptions because SQLite was not a good format.

I am not using SQLite in Elmah or otherwise that I know of. I have removed all visible refernces to SQLite, and I have removed the .dll from all configuration bin directories. But it still gets inserted with each build. I realize the exception problem is that SQLite cannot be built for CPU Any, and my environments vary from x86 to x64. But I would prefer SQLite to not even be present.

I have since uninstalled Elmah, and SQLite is still inserted into the \bin directory. I have now re-installed Elmah, and I manually delete the SQLite.dll from \bin after each build. How can I determine what is causing SQLite to be inserted into my \bin after each build?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

末蓝 2024-09-08 08:38:25

如果您不使用 SQLite,那么您只需将其从您导入引用的位置中删除即可。为了扩展这一点,我们假设您将 ELMAH 下载并解压到本地驱动器上的路径 C:\ELMAH 中。当您添加对 ELMAH 的引用时,您可能指向 C:\ELMAH\bin 下的平台版本之一,例如 C:\ELMAH\bin\net-2.0\Release代码>.从 C:\ELMAH\bin 子目录中,删除除 Elmah.dllElmah.pdb之外的所有其他不需要的程序集和文件>Elmah.xml。严格来说,您甚至不需要后两者,但仍然推荐它们。完成此操作后,您可以将对 Elmah.dll 的引用添加到 Visual Studio 中的项目中,并且任何依赖项都不会被拉入应用程序的 bin 目录中。您可能需要删除 bin 目录并重新构建项目,以删除先前参考中的 System.Data.SQLite.dll 的过时副本。只要您不使用 Elmah.SQLiteErrorLog 作为错误日志存储,ELMAH 将在没有 System.Data.SQLite.dll 的情况下继续正常工作。

根据其他建议,您不必从 ELMAH 源中删除对 SQLite 的引用并进行私有构建。

If you are not using SQLite then you need to simply remove it from the source location from where you imported the reference. To expand on that, let's assume you downloaded and unzipped ELMAH to the path C:\ELMAH on your local drive. When you added a reference to ELMAH, you probably pointed to one of the platform versions under C:\ELMAH\bin, like C:\ELMAH\bin\net-2.0\Release. From C:\ELMAH\bin sub-directories, remove all other unwanted assemblies and files except Elmah.dll, Elmah.pdb and Elmah.xml. Strictly speaking, you don't even need the latter two but they are nonetheless recommended. Once you've done that, you can add a reference to Elmah.dll to your project in Visual Studio and none of the dependencies will get pulled into your application's bin directory. You may have to delete your bin directory and re-build your project to get rid of a stale copy of System.Data.SQLite.dll from a previous reference. ELMAH will continue to work fine without System.Data.SQLite.dll as long as you do not use Elmah.SQLiteErrorLog as your error log store.

As per other suggestions, you should not have to remove references to SQLite from the ELMAH sources and make a private build.

仙女 2024-09-08 08:38:25

我认为 Visual Studio 会检测 Elmah 需要 SQLite 并在找到它时复制它。为了实现与您相同的目标,我从 Elmah 源代码中删除了所有 SQLite 内容并重新构建了它。这是一件非常无痛的事情......

I think Visual Studio will detect that SQLite is required by Elmah and copy it if it finds it. In order to achive the same goal as you I removed all SQLite stuff from the Elmah source code and re-built it. It is quite painless thing to do...

守护在此方 2024-09-08 08:38:25

使用支持“在文件中查找”的文本编辑器在所有项目文件中搜索“sqlite”。一定有什么东西在引用它。

Use a text editor with "find-in-files" support to search all your project files for "sqlite". Something must be referencing it.

ㄖ落Θ余辉 2024-09-08 08:38:25

我知道这是一个老问题,但我有类似的问题并来到这里,所以也许我的答案对其他人仍然有帮助。

只需将其添加到您的 Web 应用程序的项目文件中首选的 PropertyGroup 元素中:

<ExcludeFilesFromDeployment>bin\System.Data.SQLite.dll</ExcludeFilesFromDeployment>

I know that is an old question, but I have a similar problem and landed here, so perhaps my answer is still helpful for others.

Simply add this to your project file of your web application in a prefered PropertyGroup-element:

<ExcludeFilesFromDeployment>bin\System.Data.SQLite.dll</ExcludeFilesFromDeployment>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文