0

My project is .Net Core 3.1 and I'm using azure devop task called .Net Core to build my code.

I get this error: ##[error]projectNameSpace\Startup.cs(47,34): Error CS0103: The name 'TimeSpan' does not exist in the current context

        services.AddHsts(options =>
        {
            options.MaxAge = TimeSpan.FromDays(365);
        });

I also have "using System;" on top of the page.

Could someone help me understand this error a little better?

SmallWorld
  • 81
  • 1
  • 6

1 Answers1

0

Found the answer: I had to specify the System name space directly before timespan for it to be picked up.

        services.AddHsts(options =>
        {
            options.MaxAge = System.TimeSpan.FromDays(365);
        });

having "Using System;" on top of your class doesn't work.

SmallWorld
  • 81
  • 1
  • 6