diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index cf28d204b5..b39a7c54b6 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -134,6 +134,7 @@ public void pack_run(ChocolateyConfiguration config) { string nuspecFilePath = validate_and_return_package_file(config, Constants.ManifestExtension); var nuspecDirectory = _fileSystem.get_full_path(_fileSystem.get_directory_name(nuspecFilePath)); + if (string.IsNullOrWhiteSpace(nuspecDirectory)) nuspecDirectory = _fileSystem.get_current_directory(); IDictionary properties = new Dictionary(); // Set the version property if the flag is set @@ -145,7 +146,7 @@ public void pack_run(ChocolateyConfiguration config) // Initialize the property provider based on what was passed in using the properties flag var propertyProvider = new DictionaryPropertyProvider(properties); - var basePath = _fileSystem.get_current_directory(); + var basePath = nuspecDirectory; if (config.Information.PlatformType != PlatformType.Windows) { //bug with nuspec and tools/** folder location on Windows. @@ -159,7 +160,7 @@ public void pack_run(ChocolateyConfiguration config) } string outputFile = builder.Id + "." + builder.Version + Constants.PackageExtension; - string outputPath = _fileSystem.combine_paths(nuspecDirectory, outputFile); + string outputPath = _fileSystem.combine_paths(_fileSystem.get_current_directory(), outputFile); this.Log().Info(() => "Attempting to build package from '{0}'.".format_with(_fileSystem.get_file_name(nuspecFilePath))); diff --git a/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs b/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs index 6f16dfc224..41cde09571 100644 --- a/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs +++ b/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs @@ -66,6 +66,8 @@ public string combine_paths(string leftItem, params string[] rightItems) public string get_full_path(string path) { + if (string.IsNullOrWhiteSpace(path)) return path; + return Path.GetFullPath(path); }