I'm migrating from VS2015 to VS2017 with your newsest lib 2.4.1.
But unfortunaletly I'm geeting the following exception:
error MSB4018: The "PackageRetrievalTask" task failed unexpectedly.
error MSB4018: System.IO.DirectoryNotFoundException: Could not find a part of the path 'B:\dswork_ap\tfs\ds\Releases\20170405\Source\ds-software\packages'.
error MSB4018: at System.IO.Error.WinIOError(Int32 errorCode, String maybeFullPath)
error MSB4018: at System.IO.FileSystemEnumerableIterator1.CommonInit() error MSB4018: at System.IO.FileSystemEnumerableIterator1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler1 resultHandler, Boolean checkHost) error MSB4018: at System.IO.Directory.EnumerateFiles(String path, String searchPattern, SearchOption searchOption) error MSB4018: at Baseclass.Contrib.Nuget.Output.Build.PackageRetrievalTask.GetFilteredProjectNugetPackages(NugetPackageSource currentNugetPackageSource, HashSet1 usedNugetPackages)
error MSB4018: at Baseclass.Contrib.Nuget.Output.Build.PackageRetrievalTask.Execute()
error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d26.MoveNext()
I think your method "GetFilteredProjectNugetPackages" has a bug:
private IEnumerable<string> GetFilteredProjectNugetPackages(NugetPackageSource currentNugetPackageSource, HashSet<string> usedNugetPackages)
{
string str;
switch (currentNugetPackageSource)
{
case NugetPackageSource.PackagesConfig:
str = Path.Combine(this.SolutionPath, "packages");
break;
case NugetPackageSource.ProjectFile:
str = Environment.GetEnvironmentVariable("NUGET_PACKAGES") ?? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), @".nuget\packages");
break;
default:
throw new ArgumentOutOfRangeException("currentNugetPackageSource", currentNugetPackageSource, null);
}
return (from p in Directory.EnumerateFiles(str, "*.nupkg", SearchOption.AllDirectories)
where usedNugetPackages.Contains(Path.GetFileNameWithoutExtension(p).ToLowerInvariant())
select p).ToArray<string>();
}
str = Path.Combine(this.SolutionPath, "packages");
Here you assume the folder "packages" always exists under the solution directory, but that can be changed by a file named "nuget.config":
With this file I relink the package folder to a new destination and therefore there is no folder "packages" under the solution dir and we are getting the exception "DirectoryNotFoundException" as described above.
Hi Daniel
I'm migrating from VS2015 to VS2017 with your newsest lib 2.4.1. But unfortunaletly I'm geeting the following exception:
I think your method "GetFilteredProjectNugetPackages" has a bug:
str = Path.Combine(this.SolutionPath, "packages");
Here you assume the folder "packages" always exists under the solution directory, but that can be changed by a file named "nuget.config":In my case it looks like this:
With this file I relink the package folder to a new destination and therefore there is no folder "packages" under the solution dir and we are getting the exception "DirectoryNotFoundException" as described above.
Any solution for this?
Thank you very much for your support Andrej