visual-studio - 无法加载引用的库

标签 visual-studio dotnetnuke

开发 ASP.NET Web 应用程序项目时,我在 Visual Studio 2008 中遇到此错误。

Unable to load referenced library 'Path-to-DotNetNuke\bin\file.dll': The process cannot access the file because it is being used by another process.

这是一个具有多个模块的 DotNetNuke 项目。 IIS 从应用程序根目录下的/bin 文件夹加载所有程序集。

解决方案中的项目位于各自的/DesktopModules/ProjectName 文件夹中,并编译到项目下的 bin 文件夹中。

在我编译解决方案并使用脚本将所有项目的 dll 复制到/bin 后,出现错误。 Visual Studio 不允许我重新编译,但如果我重新启动它,一切正常。重新编译和测试整个解决方案时,这确实很烦人。每次重新编译之间都必须重新启动 Visual Studio。

当 Visual Studio 显示此错误时,我无法使用 Process Explorer 找到任何文件锁。

<小时/>

[更新]有一个old MSDN document如果您引用任何超过 64KB 的 DLL,则告诉您不要将所有 DLL 构建到单个文件夹中。该文件特别指出:

It causes the build process to fail with file lock errors when a referenced assembly exceeds 64 KB in size.

我们确实在/bin 文件夹中引用了超过 64KB 的 DLL,并且复制重新编译的 DLL 似乎会触发此问题,至少使用 VB IDE 的后台编译器是这样。

最佳答案

The error occurs after I compile the solution and copy all the projects' dlls to the /bin with a script. Visual Studio does not let me recompile, but if I restart it, everything works ok.

我建议将每个项目的输出目录设置为 DotNetNuke 网站的 bin 目录。这将帮助您避免完全复制文件的手动步骤。

要设置项目的输出目录:在解决方案资源管理器中右键单击您的项目并选择属性。选择“构建”选项卡,选择“所有配置”(位于顶部)并将“输出路径”设置为“..\..\bin”(靠近底部)。这假设您的项目文件位于模块主目录中的典型位置(例如 DesktopModules/YourModule/YourProject.csproj),否则您可以使用相邻的浏览按钮导航到网站的 bin 目录。

关于visual-studio - 无法加载引用的库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/524602/

相关文章:

jquery - 通过 WebMatrix 将 Javascript 添加到 DotNetNuke

asp.net - 是否有一个很好的 CMS 可以与 ASP.Net MVC 一起使用

.net - 无法运行 "GenerateResource"任务,因为 MSBuild 无法创建或连接到运行时为 "CLR4"且体系结构为 "x64"的任务主机

python-3.x -\ufeff 在 Visualstudio 上写入和读取 csv 文件

c# - 如何知道用户是否通过 facebook 登录

c# - DotNetZip 卡住我的应用程序?

c# - 如何在没有 "runat=server"的情况下访问 C# 代码中的 HTML 控件?

visual-studio - 为什么 VS2005 中的 Web 应用程序项目提供 'Convert to Web Application' 菜单选项

c# - 如何将大量文件放入 Visual Studio 中的命名空间?

Node.js Typescript 包含内容