\bin 中插入不需要的 SQLite
我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您不使用 SQLite,那么您只需将其从您导入引用的源位置中删除即可。为了扩展这一点,我们假设您将 ELMAH 下载并解压到本地驱动器上的路径
C:\ELMAH
中。当您添加对 ELMAH 的引用时,您可能指向C:\ELMAH\bin
下的平台版本之一,例如C:\ELMAH\bin\net-2.0\Release
代码>.从C:\ELMAH\bin
子目录中,删除除Elmah.dll
、Elmah.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 underC:\ELMAH\bin
, likeC:\ELMAH\bin\net-2.0\Release
. FromC:\ELMAH\bin
sub-directories, remove all other unwanted assemblies and files exceptElmah.dll
,Elmah.pdb
andElmah.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 toElmah.dll
to your project in Visual Studio and none of the dependencies will get pulled into your application'sbin
directory. You may have to delete yourbin
directory and re-build your project to get rid of a stale copy ofSystem.Data.SQLite.dll
from a previous reference. ELMAH will continue to work fine withoutSystem.Data.SQLite.dll
as long as you do not useElmah.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.
我认为 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...
使用支持“在文件中查找”的文本编辑器在所有项目文件中搜索“sqlite”。一定有什么东西在引用它。
Use a text editor with "find-in-files" support to search all your project files for "sqlite". Something must be referencing it.
我知道这是一个老问题,但我有类似的问题并来到这里,所以也许我的答案对其他人仍然有帮助。
只需将其添加到您的 Web 应用程序的项目文件中首选的 PropertyGroup 元素中:
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: