Open
Description
We should simplify the process of including files in the nupkg to ideally a single-line experience like most other package metadata.
One of the advantages of creating SDK-style projects is the ease of interpreting and editing project files. The majority of package metadata can be specified in a single line while embedded files like icons, license files, and README files will need a line in the <PropertyGroup>
and <ItemGroup>
.
Converting these metadata elements into one-liners will have the following impacts:
- Make the project file look "cleaner" and more interpretable.
- Make it easier for beginners to copy and paste elements from tutorials or examples.
- Make it faster and easier to include these critical metadata elements overall.
Activity
chrisraygill commentedon May 6, 2021
Closing as dupe of dotnet/sdk#2142
loic-sharma commentedon May 6, 2021
This feature would reduce 16 lines down to 11 lines, a 30% reduction in boilerplate in your project file. Before: 🙊
After: 😎
loic-sharma commentedon May 6, 2021
Reopening after offline chat with Chris. This feature request synergizes well - but is separate - from dotnet/sdk#2142. This issue is separate as licenses, icons, and readmes must be labeled in the package's generated .nuspec manifest.
MarkPflug commentedon May 10, 2021
I like this idea, but what about taking it to the extreme and defaulting all the values based on naming conventions?
How often would a user be surprised by this as a default behavior? Is it likely that there would be an icon.png, README.txt or LICENSE.txt in the project root that the user doesn't want to be used as the package asset? I suppose this would be a breaking change to existing package creation, so maybe a opt-in to this behavior would be necessary.
After 🤩:
Or maybe
<UseNugetDefaults>1</UseNugetDefaults>
, so that the defaults can be versioned in the future and allow users to opt-in by bumping the number, akin toLangVersion
for C#.JonDouglas commentedon May 18, 2021
I believe simplifying the single line defaults should be accomplished easily today & if users want to continue to do the multi-line approach with custom paths, they can do that.
Instead of another MSBuild property, I would encourage an empowering error message if the asset is not found in either experience (default or custom paths).
In other words, if you opt into the metadata, you should be guided towards being successful using it without needing to opt-in to another feature or reading documentation. You should be able to be guided by error messages if you do something wrong.
michael-hawker commentedon Sep 7, 2023
Would greatly appreciate this. Trying to add a readme file, and pack isn't finding it giving NU5039 and I have no idea why... Have both PackageReadmeFile and the pack item.
1 remaining item