Search code examples
.net-corevisual-studio-2017dynamicobject.net-standard

Cannot use DynamicObject in net standard 1.6 class library project


Refer to the screenshot below, I need to use DynamicObject in .net standard 1.6 library project.

However, I cannot add any additional dependencies by right click the Dependencies and Add Reference in Visual Studio 2017 Enterprise (15.2).

Does anyone know how to use DynamicObject in .net standard class library project targeting netstandard 1.6?

enter image description here


Solution

  • You need to add the System.Dynamic.Runtime NuGet package for the type to become available in the System.Dynamic namespace. In netstandard2.0, it will be available automatically.

    dotnet add package System.Dynamic.Runtime