Reputation: 792
I've just created an ASP .Net Web Application using the dotnet new webapp
command.
I wonder if I the wwwroot/lib
folder should be committed?
It looks like it contains versioned libraries and the version is not mentioned anywhere else in the application, so I think I should commit them.
But I really don't want to have distributions of 3rd party libraries in my git repository.
Upvotes: 7
Views: 4013
Reputation: 4892
The decision is a trade-off between build time vs having "restorable" files in a repo. In few projects, initially I ignored files under wwwroot/lib and used libman.json and restoring the client libraries at build time. This restore had an impact on the "free minutes" provided by CI (Github Actions, Azure DevOps), so I reverted my decision; and manually restored those files and pushed the wwwroot/lib files to repo.
If the free build minutes is not a constraint, I would recommend not to store the files in the source control
Upvotes: 3
Reputation: 2620
With recent changes in ASP.Net core web application. you can choose to ignore adding client side lib (content of wwwroot folder) in your version control such as git.
they need to be restored during build.
you can use LibMan to restore those libraries during build.
this article from microsoft will guide you how to enable restoring client side library during build so that you don't have to add them to your version control.
since it also contains the specific version so that there will not be any compatibility issues.
example libman.json file
{
"version": "1.0",
"defaultProvider": "cdnjs",
"libraries": [
{
"library": "[email protected]",
"files": [
"jquery.min.js",
"jquery.js",
"jquery.min.map"
],
"destination": "wwwroot/lib/jquery/"
},
{
"provider": "unpkg",
"library": "[email protected]",
"destination": "wwwroot/lib/bootstrap/"
},
{
"provider": "filesystem",
"library": "C:\\temp\\lodash\\",
"files": [
"lodash.js",
"lodash.min.js"
],
"destination": "wwwroot/lib/lodash/"
}
]
}
Hope this helpful.
Upvotes: 9
Reputation: 5041
If your team has negotiated which libraries to use and their versions are clear, you can write the list of libraries to the readme to remind other members.
If the referenced library is not large and you want to better ensure the integrity of the code, you can commit wwwroot/lib.
Upvotes: 5