none
You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' RRS feed

  • Question

  • I am getting below error while building code after migration from VS 2015 to VS 2019.

    It is poiting to some class file as below 

    AlertMgmt\AlertReportsAsCSV.cs(35):The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.


    • Edited by 000sipi Tuesday, January 7, 2020 7:05 PM
    Tuesday, January 7, 2020 7:02 PM

All replies

  • Hello,

    Does your app.config look like this? If not add the line under <startup> 

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <startup> 
            <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
        </startup>
    </configuration>
    And under project references System.dll should be version 4.0.30319


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange


    Tuesday, January 7, 2020 7:16 PM
    Moderator
  • Hi 000rakesh,

    Thank you for posting here.

    This is a known issue, please refer to the link below to resolve it.

    Error message when you compile applications to target the .NET Framework 4.5.2

    Hope this could be helpful.

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, January 8, 2020 7:24 AM
  • <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup>

    abve is already present in app.config but not working 

    Wednesday, January 8, 2020 8:15 AM
  • <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup>

    abve is already present in app.config but not working 

    Just becuase the version of the DLL is in the app.config doesn't mean that the DLL file based on the version wanted is there in the location of the programname.exe file where .NET would be looking for it. 
    Wednesday, January 8, 2020 8:01 PM