Context
When I use Add Client Side Library in VS it creates the libman.json
file in the project with the Build Action set to "Content" and the Copy to Output Directory set to "Copy if newer."
Question
Why is libman.json created with those properties set to those values? As far I understand, both are obsolete because the only thing we must pay attention to is that libman.json
should be put in source control. What am I missing?
(Optional reading)
In a scenario with multiple projects, there could be multiple libman.json
files, so the Copy if newer setting makes the build process override other libman.json
files with the last one added, and the Content setting makes the publish process override other libman.json
files with the last one as well (or fail in .NET 6, but this post is not about how to workaround that).
The simple answer (at least, in SDK-style .NET projects) is that it's coming from the SDK's file globbing patterns, most probably from the Razor SDK (here).
You'll get the same issue with any other file, such as a package.json file, including the same errors in the multiple-project scenario with duplicate file names.