Skip to content

Latest commit

 

History

History
144 lines (100 loc) · 3.71 KB

README.md

File metadata and controls

144 lines (100 loc) · 3.71 KB

.NET Core 3 / .NET 5

Compatibility (.NET 5)

https://docs.microsoft.com/en-us/dotnet/core/compatibility/5.0

Upgrade .NET Core 3 -> .NET 5

Edit csproj, change from:

<TargetFramework>netcoreapp3.1</TargetFramework>

to:

<TargetFramework>net5.0</TargetFramework>

CLI

Info

Lists all installed sdk and runtime:

dotnet --info

dotnet Tools

Open Visual Studio's Package Manager Console (where Package Source https://api.nuget.org/v3/index.json is configured) and start:

dotnet tool install --global dotnet-dump  
dotnet tool install --global dotnet-ef  
dotnet tool install --global dotnet-gcdump  
dotnet tool install --global dotnet-trace  
dotnet tool install --global dotnet-counters  
dotnet tool install --global dotnet-symbol
dotnet tool install --global Microsoft.Web.LibraryManager.Cli
  • There the shortcut for --global: -g
  • You can add specific versions. example --version 3.*

Updates:

dotnet tool update -g dotnet-dump  
dotnet tool update -g dotnet-ef  
dotnet tool update -g dotnet-gcdump  
dotnet tool update -g dotnet-trace  
dotnet tool update -g dotnet-counters  
dotnet tool update -g dotnet-symbol
dotnet tool update -g Microsoft.Web.LibraryManager.Cli

IMPORTANT: Do not install tools globally. Use dotnet-tools.json + 'dotnet tool restore' instead. Using this technique, you can have more than 1 .NET version on your build server. Details see: https://learn.microsoft.com/en-us/dotnet/core/tools/local-tools-how-to-use

Using nuget.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <activePackageSource>
        <add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" />
    </activePackageSource>
</configuration>

tool-update.cmd

SET nugetFile=.\nuget.config

dotnet tool uninstall -g dotnet-dump
dotnet tool uninstall -g dotnet-ef
dotnet tool uninstall -g dotnet-gcdump 
dotnet tool uninstall -g dotnet-trace
dotnet tool uninstall -g dotnet-counters
dotnet tool uninstall -g dotnet-symbol
dotnet tool uninstall -g Microsoft.Web.LibraryManager.Cli

dotnet tool update -g dotnet-dump  --configfile %nugetFile%
dotnet tool update -g dotnet-ef  --configfile %nugetFile%
dotnet tool update -g dotnet-gcdump  --configfile %nugetFile%
dotnet tool update -g dotnet-trace  --configfile %nugetFile%
dotnet tool update -g dotnet-counters  --configfile %nugetFile%
dotnet tool update -g dotnet-symbol  --configfile %nugetFile%
dotnet tool update -g Microsoft.Web.LibraryManager.Cli  --configfile %nugetFile%

dotnet tool list --global

Performance Diagnosing

  • dotnet counters
  • dotnet trace
  • dotnet dump
  • dotnet monitor

Upgrade to .NET 5

install or upgrade project converter

dotnet tool install -g try-convert

install or upgrade "Upgrade assistant"

dotnet tool install -g upgrade-assistant

Details: https://github.com/dotnet/upgrade-assistant

Local vs Global installation

In a CI/CD project, it is recommended to install the tools locally.

https://andrewlock.net/new-in-net-core-3-local-tools/

AutoMapper

Alternatives: Pure functions (faster, less hassle)

LibMan - Client Side Package Manager

  1. Install LibMan
  2. Right-Click on your project: Add... Client-Side Library

Information