dotnet\shared vs dotnet\packs\ref\ reference assembly vs runtime assembly

发布时间 2023-07-03 20:29:18作者: ChuckLu

dotnet\shared vs dotnet\packs\ref\

C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\6.0.16\Microsoft.AspNetCore.Identity.dll
C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\6.0.16\ref\net6.0\Microsoft.AspNetCore.Identity.dll

The paths you provided indicate the location of the Microsoft.AspNetCore.Identity.dll assembly files on your system. These files are part of the Microsoft.AspNetCore.Identity package, which provides the implementation for user authentication and authorization in ASP.NET Core applications.

The Microsoft.AspNetCore.Identity.dll file located in the C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\6.0.16 directory represents the runtime assembly, which contains the compiled code that is loaded and executed at runtime.

The Microsoft.AspNetCore.Identity.dll file located in the C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\6.0.16\ref\net6.0 directory represents the reference assembly. Reference assemblies provide metadata and serve as a "contract" that defines the available types and members of a particular library. They are used during development and compilation to provide intellisense, type checking, and other features in the IDE.

These paths are specific to your system and may vary depending on your installation and version of ASP.NET Core. The actual locations may be different on another system or with a different version of ASP.NET Core.

When developing an ASP.NET Core application, the necessary assemblies for Microsoft.AspNetCore.Identity are typically resolved automatically by the .NET Core runtime or through the NuGet package manager. You usually don't need to directly reference the assembly files by specifying their paths unless you have specific requirements or customizations.

 

Reference assemblies and runtime assemblies serve different purposes in the .NET ecosystem.

Reference Assemblies:

  • Reference assemblies are used during development and compilation.
  • They provide metadata and serve as a "contract" that defines the available types and members of a particular library.
  • Reference assemblies do not contain the actual implementation code.
  • They are used by IDEs (Integrated Development Environments) to provide intellisense, type checking, and other development features.
  • Reference assemblies are typically found in the ref directory of the package or SDK installation.

Runtime Assemblies:

  • Runtime assemblies contain the actual implementation code that is executed at runtime.
  • They are loaded and executed by the .NET runtime environment.
  • Runtime assemblies can be specific to a particular platform or framework version.
  • They are typically found in the shared or runtimes directory of the package or SDK installation.
  • Runtime assemblies are required to run the application and provide the functionality defined by the reference assemblies.

In summary, reference assemblies are used during development for compilation and IDE support, while runtime assemblies are used at runtime to execute the code and provide the desired functionality.