Is there anyway for find .nuget folder and all related folders ? such as
but should be programmatically , Cross platform way , compatible with .NET Core
My problem is finding path of
for working with Roslyn in .NET Core I need to reference them as list of MetadataReference.
MetadataReference.CreateFromFile(...)
so I think If I know about all .nuget directories. I can search into them.
You can get the path to your .nuget
folder programmatically by using this NuGet package like this:
ISettings settings = Settings.LoadDefaultSettings(null);
string nugetPath = SettingsUtility.GetGlobalPackagesFolder(settings);
There is no specific way to get the NuGet location. You can get the user profile location like below.
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
And get ProgramFiles location like below.
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)
Append the remaining path by hard coding.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.