From IT Skills
Jump to: navigation, search
  • update NUnit to version 3
    add NUnit3TestAdapter nuget package
  • StyleCop should be upgraded to Roslyn-based StyleCop#Analyzers project for developers who use only Visual Studio
    Starting in .NET 5.0, these analyzers are included with the .NET SDK and you don't need to install them separately... if you prefer a NuGet package-based model, the analyzers are also available in the Microsoft.CodeAnalysis.NetAnalyzers NuGet package
  • porting from .NET Framework to .NET Core
    1. .NET Portability Analyzer to analyze your assemblies
    2. convert all of your packages.config dependencies to the PackageReference format
      right-click on the References node or the packages.config file and select Migrate packages.config to PackageReference
    3. Convert your project file to the new SDK-style
    4. Retarget all projects you wish to port to target .NET Framework 4.7.2 or higher.
    5. Update all dependencies to .. have .NET Standard support.
    6. .NET API analyzer as a NuGet package Microsoft.DotNet.Analyzers.Compatibility.. to identify APIs that throw PlatformNotSupportedException
      For example, AppDomain support in .NET Core is limited... #elif FEATURE_ASSEMBLY_LOAD_CONTEXT // Code that uses assembly load context
    7. you can switch to targeting .NET Core (generally for applications) or .NET Standard (for libraries)... If it is a library that will be consumed by other applications or distributed via NuGet, the preference is usually to target .NET Standard. However, there may be APIs that are only available on .NET Core for performance... By targeting .NET Standard, the project will be ready to run on new platforms (such as WebAssembly)... <TargetFramework>


The entry point for ASP.NET applications is the Global.asax file... OWIN provides a pipeline to add only the modules needed. The hosting environment takes a Startup function to configure services and the app's request pipeline... Each middleware component can add one or more handlers to the request handling pipeline... With ASP.NET Core, the entry point to an application is Startup... ASP.NET Core doesn't rely on OWIN to handle the entry. Instead, that's done through the Program.cs Main method... Startup must include a Configure method... The host and application have been decoupled, which provides the flexibility of moving to a different platform in the future.

ASP.NET ... store all custom key-value pairs in the <appSettings> section of the Web.config... ASP.NET Core can store configuration data for the application in any file... The default file used in the project templates is appsettings.json... Loading this file into an instance of IConfiguration

In ASP.NET Core, static files are stored in the "web root" (<content root>/wwwroot)... by invoking the UseStaticFiles extension method from Startup.Configure

Previous versions of ASP.NET used the [Bind] attribute to protect against overposting attacks. Input formatters work differently in ASP.NET Core.


Port .NET Framework libraries