如何获取nuget缓存文件夹位置 [英] How to get the nuget cache folder location
问题描述
我正在编写一个dotnet核心工具,需要从我的工具中找到一个同级nuget软件包.如果我使用完整的.net框架,则可以使用
I am writing a dotnet core tool and need to find a sibling nuget package from my tool. If i was on full .net framework i could have found it with
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),".nuget...");
在没有环境"资料的情况下,有人建议找到package文件夹吗?(如果不存在,我可以忍受它不能在unix上运行)
Anyone have a sugestion to find the package folder when not having the Environment stuff avaible? (If nothing exists, i can live with it not working on unix)
dotnet核心工具可以在project.json工具部分中使用.
the dotnet core tools can be used in project.json tools section.
推荐答案
在Nuget 3-3.5中,您可以使用以下命令获取缓存文件夹位置
In Nuget 3-3.5 you may use the following to get cache folder location
nuget locals packages-cache -list
在Nuget 3.5之后,当前不支持此功能,但相应地此已打开的问题,Nuget团队将在将来考虑这些功能.
After Nuget 3.5 this is currently not supported, but accordingly to this opened issue, Nuget team will consider those feature in future.
这篇关于如何获取nuget缓存文件夹位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!