Skip to main content
Solved

Upgrade Error: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe' or one of its dependencies

  • 30 March 2023
  • 3 replies
  • 1474 views

Hi Team,

I’m facing issue after upgrading my customization code from 2020R2 to 2022R2. After, referring to the latest Dll, I compiled my Code. then Later on i cannot access to instance. Below is the error for your reference. 

Its urgent, could anyone please help me on this.

 

Regards,

Ramya Krishna

3 replies

Userlevel 6
Badge +6

@ramya15

  1. Find this file under your application Bin Folder:

System.Runtime.CompilerServices.Unsafe.dll

Go to properties>Details and note the product version. If it is something other than 5.0.0 xx you may need to do changes on the web config dependentAssembly part: (below is a example and you may want to try adjusting the New Version based on what your file version is)

Make sure you keep a copy of Web config file somewhere before making any changes.

      <dependentAssembly>        <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />        <bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />      </dependentAssembly>
  1. Deploy a new instance linked to same DB and the application should work without any problem.
Userlevel 4
Badge

Hi @hkabiri ,

Thank you so much. I will try this.

 

Regards,

Ramya Krishna

Hi In my case the config file matched with the version of the file which is 6.0.0. By the way I am taking the training T200 Maintenance Forms 2024 R1. When I finished the Step 1.8.4: Build the Project in Visual Studio. After built the project on VS and start including the extension library in the customization project the error came up when I refreshed the app : 

Server Error in '/SmartFix_T2001' Application.

Could not load file or assembly 'System.Security.AccessControl' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Reply