Package Management Tip – lightning speed workflow!
I really appreciate how VSCode makes it possible to do things faster, compared to Visual Studio proper.
Managing Nuget packages for me in Visual Studio Proper always involved opening up the Nuget GUI, searching for the package, selecting a version, clicking check boxes to add the package to specific projects, and then clicking through a bunch of confirmation prompts before finally installing the package.
In VSCode, a more streamlined way of doing this is to add the PackageReference directly to the project .csproj file. Just add a PackageReference element inside an ItemGroup with the Package Name and version.
You can do this in Proper as well, but it is more difficult to edit the project file, as the entire project may need to be unloaded and loaded, which can be slow.
<ItemGroup> <PackageReference Include="Polly" Version="7.2.1"/> </ItemGroup>
Save the Project File and run the dotnet restore command. The project will be built and the package assemblies will be copied to the project output folder.
dotnet restore
After editing the .csproj file I use Cntrl + ~ to jump down to the VSCode terminal to run the dotnet restore command. Managing packages this way is fast and easy.