安装NuGet包NAudio.Lame 2.1.0报错:找不到该包,如何解决?
问题:无法在.NET Framework 4.8项目中安装NAudio.Lame 2.1.0 NuGet包
我在目标框架为.NETFramework,Version=v4.8的项目abc.Win中尝试安装NuGet包NAudio.Lame 2.1.0时,出现找不到包的错误。之前我成功安装过类似的NuGet包,希望解决该问题以顺利安装包,并让以下WAV转MP3的代码正常运行:
Shared Sub ConvertWAVtoMP3(inputWavPath As String, outputMp3Path As String) Using reader = New WaveFileReader(inputWavPath) Using writer = New LameMP3FileWriter(outputMp3Path, reader.WaveFormat, LAMEPreset.STANDARD) reader.CopyTo(writer) End Using End Using End Sub
错误日志
Each package is licensed to you by its owner. NuGet is not responsible for, nor does it grant any licenses to, third-party packages. Some packages may include dependencies which are governed by additional licenses. Follow the package source (feed) URL to determine any dependencies. Package Manager Console Host Version 6.10.2.8 Type 'get-help NuGet' to see all available NuGet commands. PM> NuGet\Install-Package NAudio.Lame -Version 2.1.0 Attempting to gather dependency information for package 'NAudio.Lame.2.1.0' with respect to project 'abc.Win', targeting '.NETFramework,Version=v4.8' NuGet\Install-Package : Package 'NAudio.Lame 2.1.0' is not found in the following primary source(s): 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\,https://nuget.devexpress.com/ofhzGulIyleBlp5uTgWWzbmOCuhPO gs7vTSK8fjEKrl59uebCY/api/v3/index.json,C:\Program Files\DevExpress 24.1\Components\System\Components\Packages'. Please verify all your online package sources are available (OR) package id, version are specified correctly. At line:1 char:1 + NuGet\Install-Package NAudio.Lame -Version 2.1.0 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], Exception + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPa ckageCommand Time Elapsed: 00:00:01.8455023
解决方案
- 添加官方NuGet源:当前NuGet仅在本地SDK源、DevExpress私有源中查找,缺少官方NuGet.org源。操作步骤:
- 打开Visual Studio,依次点击「工具」→「选项」→「NuGet包管理器」→「包源」
- 点击「+」新增源,名称设为「NuGet.org」,源地址填入
https://api.nuget.org/v3/index.json - 勾选新源确保启用
- 确认包信息正确性:验证
NAudio.Lame包ID无误,且2.1.0版本确实存在(可在添加官方源后,通过NuGet包管理器搜索确认) - 改用UI安装方式:如果命令行安装失败,可通过「项目」→「管理NuGet包」,搜索
NAudio.Lame并选择2.1.0版本安装 - 清理NuGet缓存:执行命令
dotnet nuget locals all --clear清除缓存后,重新尝试安装
内容的提问来源于stack exchange,提问作者RayT
相关产品推荐
相关产品推荐

