When building Fake for assembly that references a .NetCore 2.0 assembly, getting XYZ.fakes : error : Could not resolve assembly 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'. Are you missing an assem

WhatsaMattaU 0 Reputation points
2023-09-22T15:41:31.65+00:00

Hi,

When building a fake for an assembly that references a .NetCore 2.0 library, the process fails with the following error:

XYZ.fakes : error : Could not resolve assembly 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'. Are you missing an assembly reference?

The unit test project is build with .Net 4.8.

I am seeing the same behavior in VS 2017, 19, and 22.

Thank you

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,061 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 28,661 Reputation points Microsoft Vendor
    2023-09-25T03:29:16.7433333+00:00

    Hi @WhatsaMattaU,

    Welcome to Microsoft Q&A! 

    Do you have the assembly 'System.Private.CoreLib’ referenced in your project?

    Please ensure that the assembly version specified in your project matches the version of the assembly you are trying to reference. 

    You can try to clean and rebuild the solution. You can create a new Unit Test project and verify it again. 

    Sincerely,

    Anna


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


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.