Nuget package error - Could not locate install path after package was installed.
Hi there,
I'm trying to add nuget package to my script and I'm getting the following error. I would be happy if you could help me, thanks.
Package Cache Folder: C:\Users{user_name}\AppData\Local\NetPad\Cache\Packages
using Microsoft.Extensions.DependencyInjection; var serviceProvider = new ServiceCollection() .AddScoped<ICustomer, Lcw>() .AddScoped<ICustomer, Gratis>() .BuildServiceProvider(); var serv = serviceProvider.GetRequiredService<ICustomer>(); serv.Account.Dump(); public interface ICustomer { string Get(); Account Account {get;} } public enum Account { Lcw = 1, Gratis = 2 } public class Lcw : ICustomer { public string Get() => "Lcw"; public Account Account => Account.Lcw; } public class Gratis : ICustomer { public string Get() => "Gratis"; public Account Account => Account.Gratis; }
System.Exception: Could not locate install path after package was installed. Package ID: Microsoft.Extensions.DependencyInjection.Abstractions, Version: 8.0.0
at NetPad.Packages.NuGetPackageProvider.InstallPackagesAsync(PackageIdentity explicitPackageToInstallIdentity, IEnumerable`1 packagesToInstall, SourceCacheContext sourceCacheContext, ILogger logger, CancellationToken cancellationToken) in /home/tips/Source/TIPS/NetPad/src/Infrastructure/NetPad.Infrastructure/Packages/NuGetPackageProvider.cs:line 530
at NetPad.Packages.NuGetPackageProvider.InstallPackagesAsync(PackageIdentity explicitPackageToInstallIdentity, IEnumerable`1 packagesToInstall, SourceCacheContext sourceCacheContext, ILogger logger, CancellationToken cancellationToken) in /home/tips/Source/TIPS/NetPad/src/Infrastructure/NetPad.Infrastructure/Packages/NuGetPackageProvider.cs:line 561
at NetPad.Packages.NuGetPackageProvider.InstallPackageAsync(String packageId, String packageVersion, DotNetFrameworkVersion dotNetFrameworkVersion) in /home/tips/Source/TIPS/NetPad/src/Infrastructure/NetPad.Infrastructure/Packages/NuGetPackageProvider.cs:line 156
at NetPad.Packages.NuGetPackageProvider.GetPackageAndDependencyAssetsAsync(String packageId, String packageVersion, DotNetFrameworkVersion dotNetFrameworkVersion) in /home/tips/Source/TIPS/NetPad/src/Infrastructure/NetPad.Infrastructure/Packages/NuGetPackageProvider.cs:line 231
at NetPad.Utilities.ReferenceUtil.GetAssetsAsync(IEnumerable`1 references, DotNetFrameworkVersion dotNetFrameworkVersion, IPackageProvider packageProvider) in /home/tips/Source/TIPS/NetPad/src/Core/NetPad.Domain/Utilities/ReferenceUtil.cs:line 26
at NetPad.Runtimes.ExternalProcessScriptRuntime.GetRunDependencies(RunOptions runOptions) in /home/tips/Source/TIPS/NetPad/src/Core/ScriptRuntimes/NetPad.ExternalProcessScriptRuntime/ExternalProcessScriptRuntime.Setup.cs:line 33
at NetPad.Runtimes.ExternalProcessScriptRuntime.RunScriptAsync(RunOptions runOptions) in /home/tips/Source/TIPS/NetPad/src/Core/ScriptRuntimes/NetPad.ExternalProcessScriptRuntime/ExternalProcessScriptRuntime.cs:line 81
I can see the packages are downloaded to the relevant directory
