Reputation: 14080
I am trying do a very simple thing in console app:
using Microsoft.Azure.WebJobs.Extensions.Timers;
using NCrontab;
using System;
namespace ConsoleApp3
{
class Program
{
static void Main(string[] args)
{
var nCrontabSchedule = CrontabSchedule.Parse("5 4 * * * *");
}
}
}
But it gives me this error:
Severity Code Description Project File Line Suppression State
Error CS0433 The type 'CrontabSchedule' exists in both 'NCrontab.Signed, Version=3.2.20120.0, Culture=neutral, PublicKeyToken=5247b4370afff365' and 'NCrontab, Version=3.2.20120.0, Culture=neutral, PublicKeyToken=null' ConsoleApp3 C:\Users\bowmanzh\source\repos\ConsoleApp3\Program.cs 12 Active
It didn't even finish compile! It’s hard for me to understand what’s going on here, I just want to use a simple thing.
Why is there a version conflict here? In fact, I referenced two packages, this is my .csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="3.0.6" />
<PackageReference Include="NCrontab" Version="3.2.0" />
</ItemGroup>
</Project>
I have already googled, they say something like Aliases, but in fact on my side it doesn't have this property.
I have already tried:
using v2 = NCrontab;
using System;
using Microsoft.Azure.WebJobs.Extensions.Timers;
namespace ConsoleApp3
{
class Program
{
static void Main(string[] args)
{
v2.CrontabSchedule nCrontabSchedule = v2.CrontabSchedule.Parse("5 4 * * *");
}
}
}
But it didn't work.
How can I solve this problem?
Thank you so much for taking the time to check!
Upvotes: 0
Views: 807
Reputation: 11
I encountered this same problem. Trying unstalling the NCrontab nuget package and installing NCrontab.Signed instead. This resolved the issue for me.
Upvotes: 1