This is an unhandled exception in MSBuild -- PLEASE UPVOTE AN EXISTING ISSUE OR FILE A NEW ONE AT https://aka.ms/msbuild/unhandled.

Anonymous
2022-12-01T14:43:04.267+00:00

Hi I am getting this error when I build my project,

This is an unhandled exception in MSBuild -- PLEASE UPVOTE AN EXISTING ISSUE OR FILE A NEW ONE AT https://aka.ms/msbuild/unhandled.

(0,0): error : This is an unhandled exception in MSBuild -- PLEASE UPVOTE AN EXISTING ISSUE OR FILE A NEW ONE AT https://aka.ms/msbuild/unhandled.
System.InvalidOperationException: Could not load file or assembly 'System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.

How can I fix this issue?

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
39,201 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Michael Taylor 54,321 Reputation points
    2022-12-01T15:52:15.483+00:00

    Check in the GAC to see if the system.memory assembly is in there.

       gacutil /l "System.Memory"  
    

    If it is then remove it.

       gacutil /u "System.Memory"  
    
    0 comments No comments

  2. Burak Kalafat 0 Reputation points
    2023-04-14T04:25:26.48+00:00

    I get some error. After updating visual studio 2022 enterprise 17.5.3 to 17.5.4.

    Could not load file or assembly 'System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
    
       at Microsoft.AspNetCore.WebUtilities.QueryHelpers.AddQueryString(String uri, IEnumerable`1 queryString)
       at RestUtils.CdmRestClient.GetFromUrl[TResult](String service, String method, Dictionary`2 urlArgs) in C:\work
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.