Is your feature request related to a problem? Please describe.
NuGet's nuget.exe pack command supports the -OutputFileNamesWithoutVersion switch, which strips the version from the
output .nupkg filename (e.g., MyPackage.nupkg instead of MyPackage.1.0.0.nupkg). However, the dotnet pack CLI does not
expose this option. Users who need versionless output filenames — for example, in CI/CD pipelines where a stable
artifact path is needed — must resort to workarounds like passing raw MSBuild properties (
-p:OutputFileNamesWithoutVersion=true) for project-based packing, and have no option at all for nuspec-based packing.
Describe the solution you'd like
Add a --OutputFileNamesWithoutVersion boolean flag to the dotnet pack CLI command, consistent with NuGet's existing
switch name. It should work for both code paths:
- MSBuild-based packing (project files): Forward the flag as the MSBuild property
-property:OutputFileNamesWithoutVersion=true, which NuGet's Pack.targets already consumes.
- NuSpec-based packing (.nuspec files): Set PackArgs.OutputFileNamesWithoutVersion so that PackCommandRunner omits
the version from the output filename.
Additional context
- NuGet already defines and uses OutputFileNamesWithoutVersion in both PackArgs.cs and
PackCommandRunner.GetOutputFileName(), so no NuGet-side changes are needed.
- The MSBuild property $(OutputFileNamesWithoutVersion) is already wired in NuGet.Build.Tasks.Pack.targets — the
dotnet pack CLI just needs to surface it as a first-class option.
Is your feature request related to a problem? Please describe.
NuGet's nuget.exe pack command supports the -OutputFileNamesWithoutVersion switch, which strips the version from the
output .nupkg filename (e.g., MyPackage.nupkg instead of MyPackage.1.0.0.nupkg). However, the dotnet pack CLI does not
expose this option. Users who need versionless output filenames — for example, in CI/CD pipelines where a stable
artifact path is needed — must resort to workarounds like passing raw MSBuild properties (
-p:OutputFileNamesWithoutVersion=true) for project-based packing, and have no option at all for nuspec-based packing.
Describe the solution you'd like
Add a --OutputFileNamesWithoutVersion boolean flag to the dotnet pack CLI command, consistent with NuGet's existing
switch name. It should work for both code paths:
-property:OutputFileNamesWithoutVersion=true, which NuGet's Pack.targets already consumes.
the version from the output filename.
Additional context
PackCommandRunner.GetOutputFileName(), so no NuGet-side changes are needed.
dotnet pack CLI just needs to surface it as a first-class option.