Asp.net 4.5 : The type 'System.Object' is defined in an assembly that is not referenced

Dung Do Tien May 12 2021 31

I have a solution with many projects in Asp.Net Framework 4.5.2 and I want to add other project support trace logs to the Kafka server.

My project still working fine but when I add existed that project into the solution I got an error the type is defined in an assembly that is not referenced. you must add a reference to assembly

Asp.net 4.5 : The type 'System.Object' is defined in an assembly that is not referenced 
Error CS0012 The type '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'. 
D:Myproject\App_Start\WebApiConfig.cs

They are same have the same project target is 4.5.2. I tried to rebuild but it does still not work. 

How can I resolve this issue? 

Have 1 answer(s) found.
  • X

    Xhana Ahmetaj May 12 2021

    You need to check web.config of the new project you add more to your solution, It must has config below:

    <compilation targetFramework="4.5" debug="true" >
      <assemblies>
        <add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </assemblies>
    </compilation>

    You need to add System.Runtime package, It'll resolve your issues. 

Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close