Random error after upgrading some NuGet packages: “You must add a reference to assembly ‘netstandard, Version=2.0.0.0”

Just a very quick write-up on this as it kept me busy for a couple of hours looking for a solution.

After upgrading a number of NuGet packages (Microsoft ASPNet WebApi 2.2 Core Libraries, Microsoft ASPNet MVC, HtmlAgilityPack), my perfectly working Sitecore local development setup stopped working, instead throwing the exception

CS0012: The type ‘System.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 scratching my head, the solution as highlighted in this Stackoverflow question was quite literally what the exception error said: I had to add the following line in web.config, under configuration/system.web/compilation/assemblies:

<add assembly="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"/>

Which solved my problem. A reference to this assembly was most likely broken during the upgrade, making this line a requirement.

Leave Comment

Your email address will not be published. Required fields are marked *