I know that NuGet packages (at least nowadays) should not be included in version control. How should I exclude files a package adds to my project?
For example: I have a .NET MVC project that uses the bootstrap NuGet package. It adds some CSS, JS, and font files to Content, Scripts, and fonts, respectively. Should these files be included in my source control? If not, what would be the best way to ignore them? (I'm using GIT on this particular project.)
Generally speaking, generated files should not be tracked by your source control tool. Here is a good question that addresses pros/cons of doing so.
You can ignore those files and directories by creating a .gitignore
file at the root of your repo.
Following your example package above, you could ignore that content by adding this to your .gitignore file:
Content
Scripts
fonts
Here is some more documentation on ignoring files with Git with .gitignore
.
You can also populate your .gitignore based on what the VisualStudio project uses.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With