3 – Error CS0012: The type ‘Object’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’.

Recently I was consuming library from github, which used netstandard library. My project is in .NET Framework 4.6.2 so I had to also add reference of .NET Standard library in my project. Even after adding reference I was getting the error while compiling project through TFS / Azure DevOps Build.

Error was:

Error CS0012: The type ‘Object’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’.

After lot of struggling found solution to be simple and it is a workaround and it works.

Solution is to include below single line of code in .csproj file

<Reference Include=”netstandard” />

All you have to do is edit project file in case of C# it will be csproj in case of Visual Basic (VB) it will be vbproj of the project which is failing to build in TFS / Azure DevOps.

Find a section named ItemGroup and type below line:

<Reference Include=”netstandard” />

Save file, and you are done.

About the Author

Leave a Reply

Your email address will not be published.