The type or namespace name 'Web' does not exist in the namespace 'System'

3.6k views Asked by At

I am building a project in .NET Core where I need to use the Framework Assembly System.Web.Extension. I install the assembly via Reference -> Add Reference -> System.Web.Extension 4.0.0.0. After it installed it appears under DNX 4.5.1 -> FrameworkAssemblies. Package restoration was successful as well.

Following entry is added in project.json file as expected.

"frameworkAssemblies": {"System.Web.Extensions": "4.0.0.0"}

But when I am trying to compile the project using dnu build, following error appears!

D:\Projects\ColemanApi\src\ColemanApi\Controllers\ValuesController.cs(7,14): DNXCore,Version=v5.0 error CS0234: The type or namespace name 'Web' does not exist in the namespace 'System' (are you missing an assembly reference?)

D:\Projects\ColemanApi\src\ColemanApi\Controllers\ValuesController.cs(51,27): DNXCore,Version=v5.0 error CS0246: The type or namespace name 'JavaScriptSerializer' could not be found (are you missing a using directive or an assembly reference?)

I was following this post but it does not have a solution for .net 5 or I don't know how to Copy Local in .net 5 as I did not see any Properties option in Assembly's fly-out menu.

Please see attached image: enter image description here

And here is a screenshot of the compilation error: enter image description here

Somebody please help. I am totally screwed up!

UPDATE

I ran dnu list and it shows the System.Web.Extensions is resolved. Please see the screenshot below:

enter image description here

Thanks in advance.

1

There are 1 answers

0
Emyr On

If it does, is there any alternative solution to deserialize a JSON string without removing "dnxcore50"?

JSON.Net provides this functionality. If you want to use this on Core...

https://github.com/JamesNK/Newtonsoft.Json/issues/618#issuecomment-186441534

There won't be any progress until .NET Core RC2. When it is released I'll create a netstandard build and release a new version of Json.NET.