From 7b24a9f9802cbf395bd3e27c2d1ef513cd2b211e Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 28 Jan 2016 14:19:32 -0600 Subject: [PATCH] (GH-542) Rename nuspec.template file Unfortunately nuspec can't be saved as nuspecs in a package. So the name of the nuspec will need to be *.nuspec.template for it to pack up nicely. Find that file and rename it to .nuspec on install. --- .../services/ChocolateyPackageService.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs index 53ac5d4cdb..ac0b4d3734 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs @@ -780,7 +780,14 @@ private void handle_template_packages(ChocolateyConfiguration config, PackageRes var templatesFolderToCopy = _fileSystem.directory_exists(templatesPath) ? templatesPath : packageResult.InstallLocation; FaultTolerance.try_catch_with_logging_exception( - () => _fileSystem.copy_directory(templatesFolderToCopy, installTemplatePath, overwriteExisting: true), + () => + { + _fileSystem.copy_directory(templatesFolderToCopy, installTemplatePath, overwriteExisting: true); + foreach (var nuspecFile in _fileSystem.get_files(installTemplatePath, "*.nuspec.template").or_empty_list_if_null()) + { + _fileSystem.move_file(nuspecFile,nuspecFile.Replace(".nuspec.template",".nuspec")); + } + }, "Attempted to copy{0} '{1}'{0} to '{2}'{0} but had an error".format_with(Environment.NewLine, templatesFolderToCopy, installTemplatePath)); string logMessage = " Installed/updated {0} template.".format_with(templateFolderName);