-
Notifications
You must be signed in to change notification settings - Fork 393
Open
Labels
area:package-managementgathering-feedbackThe issue requires feedback in order to be planned, please comment if the feature is useful for youThe issue requires feedback in order to be planned, please comment if the feature is useful for youhelp-wantedgood opportunity for contribution to the repogood opportunity for contribution to the repotriagedThe issue was evaluated by the triage team, placed on correct area, next action defined.The issue was evaluated by the triage team, placed on correct area, next action defined.
Milestone
Description
Is your feature request related to a problem? Please describe.
As CentralPacakgeManagement becomes more mainstream it is something we would like to offer as an option in our templates like:
dotnet new mytemplate -cpm
Currently we would need to have dependencies in our template like:
<ItemGroup>
<!--#if (useCentralPackageManagement)-->
<PackageReference Include="PackageA" />
<PackageReference Include="PackageB" />
<!--#else-->
<PackageReference Include="PackageA" Version="8.0.0" />
<PackageReference Include="PackageB" Version="8.0.0" />
<!--#endif-->
</ItemGroup>
Describe the solution you'd like.
Add a post action that can work from any host (VS/CLI/etc) which can remove versions on PackageReferences. This could be purpose build to strip out any PackageReference Version. Or to make this the most useful for a variety of situations perhaps a Regex Replace Post Action could be more useful.
"postActions": [{
"condition": "(useCentralPackageManagement)",
"description": "Removes the PackageReference Versions in the generated csproj.",
"args": {
"files": "**\\*.csproj",
"pattern": "(\\s?Version=\\\"\\d+\\.\\d+(.\\d+)?(.\\d+)?(-[A-Za-z\\.0-9]+)?\\\")",
"replace": ""
},
"manualInstructions": [{
"text": "Remove the PackageReference Versions'"
}],
"actionId": "Some Id",
"continueOnError": false
}]
Additional context
No response
Evangelink, seangwright, Thieum, Trokkin, edvilme and 3 more
Metadata
Metadata
Assignees
Labels
area:package-managementgathering-feedbackThe issue requires feedback in order to be planned, please comment if the feature is useful for youThe issue requires feedback in order to be planned, please comment if the feature is useful for youhelp-wantedgood opportunity for contribution to the repogood opportunity for contribution to the repotriagedThe issue was evaluated by the triage team, placed on correct area, next action defined.The issue was evaluated by the triage team, placed on correct area, next action defined.