ToggleNavigation
{{systemName}}
{{ info.Title }}
{{info.Title}}
{{ menu.Title }}
{{menu.Title}}
Login
|
Sign Out
Search
depends on System.Runtime.CompilerServices.Unsafe, and the versions don’t match
Author: ych
### depends on System.Runtime.CompilerServices.Unsafe, and the versions don’t match #### for example ``` Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1' The located assembly's manifest definition does not match the assembly reference. (HRESULT: 0x80131040) ``` This usually happens because System.Memory depends on System.Runtime.CompilerServices.Unsafe, and the versions don’t match. #### 1. Most common cause Your project references System.Memory, which internally requires System.Runtime.CompilerServices.Unsafe. Example dependency chain: ``` Some Library ↓ System.Memory (4.5.x) ↓ System.Runtime.CompilerServices.Unsafe ``` If your project loads a different version than the one expected (for example 6.0 instead of 4.0.4.1), .NET Framework throws this error. #### 2. Recommended stable versions (.NET Framework) If your project is .NET Framework 4.7.2 / 4.8, the safest versions are: Packag|Version -|- System.Memory|4.5.5 System.Runtime.CompilerServices.Unsafe|6.0.0 Install them via NuGet: ``` Install-Package System.Memory -Version 4.5.5 Install-Package System.Runtime.CompilerServices.Unsafe -Version 6.0.0 ``` #### 3. Add bindingRedirect (important) In App.config or Web.config: ```
``` This tells the CLR to redirect all older versions to the installed version.
Comments Section
Log in
Copyright © 2021-
YCH Dev Co., Ltd. All Rights Reserved.