How to add `System.Web.Extensions` assembly to .net core project in vscode
Here I just want to know how to add assembly.
In general, you would have nodes like this in your .csproj
:
<Reference Include="System.Web.Extensions" />
However, since you are using .NET Core, you cannot reference assemblies that are targeted to the full .NET Framework. In this case, System.Web.Extensions
is one of those, so you cannot use it in your .NET Core project.
System.Web.Extensions
is part of full .net framework . If you want to serialize and deserialize object,You can use Newtonsoft.Json
,
#using Newtonsoft.Json
....
JsonConvert.DeserializeObject(json);
Update
Just get package name and version number from NuGet and add to .csproj then save. You will be prompted to run restore that will import new packages.
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>
Replace System.Web.Extensions.Serialization
with System.Text.Json.Serialization
. The usage of the two is very similar.