.Net Core 3.0 cannot load custom addin #3090
-
Hi Team, Hi Team, I have update my Cake Version to 0.35 because 0.35 has support for .net core 3.0. When I referenced my .dll to Cake script and try to run Task I got Could you please help me with that? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
System.Text.Json assembly isn't currently automatically loaded under .NET Core 3, but you can load it, example: #r "System.Text.Json"
public class WeatherForecast
{
public DateTimeOffset Date { get; set; }
public int TemperatureC { get; set; }
public string Summary { get; set; }
}
static string SerializeAsJson<T>(this T value)
{
return System.Text.Json.JsonSerializer.Serialize<T>(value);
}
var weatherForecast = new WeatherForecast{
Date = DateTimeOffset.UtcNow,
TemperatureC = 11,
Summary ="Cloudy"
};
var json = weatherForecast.SerializeAsJson();
Information(json); will output {"Date":"2019-11-04T13:03:47.0779982+00:00","TemperatureC":11,"Summary":"Cloudy"} To use it on .NET 4.8 or .NET Core 2.1 you'll need to fetch dependency from nuget using addin syntax #addin nuget:?package=System.Text.Json&version=4.6.0&loaddependencies=true |
Beta Was this translation helpful? Give feedback.
System.Text.Json assembly isn't currently automatically loaded under .NET Core 3, but you can load it, example:
will output
…