c# - Visual Studio Nuget 安装 'app.config 正在使用中'
问题描述
我似乎无法在我的 C# 类库中安装 nuget 包 Oracle.ManagedDataAccess 18.3.0.0。
每当我尝试安装它时,它都会引发以下错误:
System.IO.InvalidDataException: An error occurred while applying transformation to 'App.config' in project 'MyClassLibrary' The process cannot access the file 'R:\DEV\MyClassLibrary\App.config' because it is being used by another process. ---> System.IO.IOException: The process cannot access the file 'R:\DEV\MyClassLibrary\App.config' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at NuGet.ProjectManagement.FileSystemUtility.CreateFile(String fullPath)
当我在尝试安装 nuget 之前删除 app.config 时,它将在安装 nuget 期间重新创建它,并且此错误仍然存在。它拒绝安装。
AFAIK 没有其他进程正在运行。重新启动后,同样的问题仍然存在。
我正在使用 Visual Studio 2017 Pro。可能是什么问题?
解决方案
您可以按照此问题中的解决方法来确定哪个文件占用了文件。
也试试:
1.卸载当前项目中的那个包
2.Tools=>Nuget包管理器=>包管理器设置=>清除所有nuget缓存
3.导航到项目目录,删除bin和obj文件夹。如果存在,还要删除解决方案目录中的包文件夹。
4.然后以管理员身份启动VS安装包,我建议你可以通过Nuget包管理器UI安装它。
推荐阅读
- javascript - map() 中的 reactjs-jsx 计数索引
- python - 如果文件与给定的文件名匹配,如何打开文件(使用语音识别获得的文件名)
- go - 在 Go Gorm 中添加具有多对多反向引用的记录
- python-3.x - Jupyter Notebook:终端不可用
- angular - 如何在 Angular 9 组件单元测试中调用假函数
- uart - UART 使能后 PIC18F67K22 TX 引脚为低电平
- xamarin.forms - MVVMCross 如何在 View Code 后面获取 ViewModel 实例
- javascript - 如何修复d3中的多画笔图表
- angular - 移除 Angular Material 切换按钮焦点样式
- java - Selenium Java 元素不可交互