Upgrading .NET dependencies: Essential dotnet CLI commands
Need to update your .NET packages? Here are the key commands you’ll need:
Check for Updates:
shell code snippet start
dotnet list package --outdated
shell code snippet end
Update Packages:
Single package (latest version):
shell code snippet start
dotnet add package PackageName
shell code snippet end
Specific version:
shell code snippet start
dotnet add package PackageName --version 1.2.3
shell code snippet end
Bulk updates:
While there’s no built-in command to update everything, you can use dotnet-outdated
:
shell code snippet start
dotnet tool install --global dotnet-outdated-tool
dotnet outdated -u # Updates all packages
shell code snippet end
Pro tip: Always backup, and test after upgrading. Add --prerelease
if you need preview versions.
How to set up the vertical ruler in VS Code
There’s this handy vertical ruler feature in most IDEs, showing a simple guide line to help maintain consistent line lengths across your codebase. It’s one of those small tools that makes a big difference in keeping your code maintainable and easier to review.
Here’s how to set it up in VS Code: Open your settings file and add the editor.rulers
configuration. You can set a single ruler at the traditional 80-character mark, or add multiple guides for different contexts. Here’s an example that sets the ruler at 80 characters:
json code snippet start
"editor.rulers": [80]
json code snippet end
Remember, this ruler is just a visual guide - you’ll still need to format your code manually or with your preferred auto-formatter.