diff --git a/src/chocolatey.tests.integration/scenarios/PackScenarios.cs b/src/chocolatey.tests.integration/scenarios/PackScenarios.cs index bab066a77a..fc0490a6cc 100644 --- a/src/chocolatey.tests.integration/scenarios/PackScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/PackScenarios.cs @@ -70,6 +70,12 @@ public void generated_package_should_be_in_current_directory() File.Exists(package_path).ShouldBeTrue(); } + + [Fact] + public void sources_should_be_set_to_current_directory() + { + Configuration.Sources.ShouldEqual(Scenario.get_top_level()); + } } [Concern(typeof(ChocolateyPackCommand))] @@ -100,6 +106,12 @@ public void generated_package_should_be_in_specified_output_directory() File.Exists(package_path).ShouldBeTrue(); } + + [Fact] + public void sources_should_be_set_to_specified_output_directory() + { + Configuration.Sources.ShouldEqual("PackageOutput"); + } } private const string NuspecContent = @" diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index baca0c15e8..ed3a4f0a54 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -271,7 +271,10 @@ public void pack_run(ChocolateyConfiguration config) } string outputFile = builder.Id + "." + builder.Version + Constants.PackageExtension; - string outputPath = _fileSystem.combine_paths(config.OutputDirectory ?? _fileSystem.get_current_directory(), outputFile); + string outputFolder = config.OutputDirectory ?? _fileSystem.get_current_directory(); + string outputPath = _fileSystem.combine_paths(outputFolder, outputFile); + + config.Sources = outputFolder; this.Log().Info(config.QuietOutput ? ChocolateyLoggers.LogFileOnly : ChocolateyLoggers.Normal, () => "Attempting to build package from '{0}'.".format_with(_fileSystem.get_file_name(nuspecFilePath))); @@ -376,6 +379,7 @@ public ConcurrentDictionary install_run(ChocolateyConfigu else { var packageFile = new OptimizedZipPackage(_fileSystem.get_full_path(packageName)); + version = packageFile.Version; packageNames.Add(packageFile.Id); } }