{"record":{"id":"a6fb632a4f0b48b7","repo":"chocolatey/choco","slug":"automatic-package-creation-from-installer-files-on","errorCode":null,"errorMessage":"Automatic package creation from installer files only available in Business\r\n edition. See https://chocolatey.org/compare for details.","messagePattern":"Automatic package creation from installer files only available in Business\r\n edition\\. See https://chocolatey\\.org/compare for details\\.","errorType":"validation","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs","lineNumber":114,"sourceCode":"                    }\r\n                    else\r\n                    {\r\n                        configuration.NewCommand.TemplateProperties.Add(propName, propValue);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        public virtual void Validate(ChocolateyConfiguration configuration)\r\n        {\r\n            if (string.IsNullOrWhiteSpace(configuration.NewCommand.Name))\r\n            {\r\n                throw new ApplicationException(\"Name is required. Please pass in a name for the new package.\");\r\n            }\r\n\r\n            if (configuration.NewCommand.Name.StartsWith(\"-file\", StringComparison.OrdinalIgnoreCase) || configuration.NewCommand.Name.StartsWith(\"--file\", StringComparison.OrdinalIgnoreCase))\r\n            {\r\n                throw new ApplicationException(@\"Automatic package creation from installer files only available in Business\r\n edition. See https://chocolatey.org/compare for details.\");\r\n            }\r\n        }\r\n\r\n        public virtual void HelpMessage(ChocolateyConfiguration configuration)\r\n        {\r\n            this.Log().Info(ChocolateyLoggers.Important, \"New Command\");\r\n            this.Log().Info(@\"\r\nChocolatey will generate package specification files for a new package.\r\n\");\r\n\r\n            \"chocolatey\".Log().Info(ChocolateyLoggers.Important, \"Usage\");\r\n            \"chocolatey\".Log().Info(@\"\r\n    choco new <name> [<options/switches>] [<property=value> <propertyN=valueN>]\r\n\r\nPossible properties to pass:\r\n    packageversion\r\n    maintainername\r","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/chocolatey/choco/blob/0d5abdd10cc177a141e69547cad6935b419b6c17/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs#L96-L132","documentation":"Thrown by ChocolateyNewCommand.Validate when the user passes a package name that starts with '-file' or '--file'. This triggers the automatic package creation from installer files feature, which is licensed only for Chocolatey Business edition. The open-source/free build refuses it and points the user to the comparison page. The check is a naive string-prefix match on configuration.NewCommand.Name, so any name beginning with those flags is rejected.","triggerScenarios":"Running 'choco new <pkg> --file=<installer>' or 'choco new <pkg> -file=<installer>' in the free/open-source edition of Chocolatey. Also triggered if a package name literally begins with the strings '-file' or '--file' for any reason.","commonSituations":"A developer on Chocolatey FOSS edition tries to auto-generate a .nuspec/spec from an existing .exe/.msi installer and passes --file. The free edition does not include the Package Internalizer / automatic package generator; that is a Business (licensed) feature.","solutions":["If you need automatic package creation from installer files, obtain a Chocolatey Business license and install the licensed extension.","If you do not have a Business license, create the package skeleton manually with 'choco new <pkgname>' (without --file) and fill in the install logic yourself.","Ensure the package name does not accidentally begin with '-file' or '--file' due to argument mis-ordering."],"exampleFix":"// before\nchoco new mypkg --file=\"installer.exe\"\n// after (FOSS edition — manual skeleton)\nchoco new mypkg\n// then edit tools/chocolateyInstall.ps1 to invoke installer.exe","handlingStrategy":"validation","validationCode":"// Before calling choco new, verify you are not triggering the --file path\n// unless you have a Business license\nif (!hasBusinessLicense && (packageName.StartsWith(\"--file\", StringComparison.OrdinalIgnoreCase) || packageName.StartsWith(\"-file\", StringComparison.OrdinalIgnoreCase)))\n{\n    Console.Error.WriteLine(\"Automatic package creation from installers requires Business edition.\");\n    return;\n}","typeGuard":"static bool CanAutoGenerateFromInstaller(bool hasBusinessLicense) => hasBusinessLicense;","tryCatchPattern":null,"preventionTips":["Do not pass --file/-file to 'choco new' unless running Chocolatey Business edition.","Use 'choco new <name>' for the free edition and write install scripts manually."],"tags":["chocolatey","licensing","new-command","business-edition"],"backgroundTag":null,"analyzedSha":"0d5abdd10cc177a141e69547cad6935b419b6c17","analyzedAt":"2026-08-13T18:33:03.301Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}