dotnet / dotnet/project-system
Condition package properties on IsPackable property
- Dominant language
- C#
- Stars
- 1k
- Forks
- 415
- PR merge metrics
- No merged PRs in 30d
Description
A project can only be packed if the `IsPackable` property is true.
For example:
1. Create a new ASP.NET Core Web Application
2. Right click the project and select Pack
3. See warning:
> C:\Program Files\dotnet\sdk\6.0.300-preview.22178.8\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(203,6): warning : **This project cannot be packaged because packaging has been disabled. Add true to the project file to enable producing a package from this project.**
Note that the project can be made packable by manually setting the `IsPackable` property to `true`.
Even though this web app is not packable, we still show all the package properties in the UI.
I can see two possible ways to improve this:
1. Model `IsPackable` as a non-visible property in `ConfigurationGeneralPage.xaml`
2. Model `IsPackable` as a visible and editable property in `PackagePropertyPage.xaml`
In either case, we can use visibility conditions to hide pack-related properties from the UI. Note that some properties on the "Packaging" page, such as versions, have utility outside of pack actions. We would need to do a proper review here.
Contributor guide
Assessment
This issue has not been assessed yet.