C
C#2y ago
scac

❔ DateOnly is not available in .net6.0 for me

I had to add these to make it available:
<FrameworkReference Include="Microsoft.NETCore.App" />
<PackageReference Include="System.Runtime" Version="4.3.1" />
<FrameworkReference Include="Microsoft.NETCore.App" />
<PackageReference Include="System.Runtime" Version="4.3.1" />
But now I'm getting warnings that these aren't necessary because they're implicitly referenced. What could be happening that I need to add them?
24 Replies
Henkypenky
Henkypenky2y ago
can you show your csproj you should not need to include that framework reference if you have this
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
you are probably not on .NET 6.0
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
scac
scacOP2y ago
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<!-- <Nullable>enable</Nullable> -->
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.10">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.10" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.25.0" />
<FrameworkReference Include="Microsoft.NETCore.App" />
<PackageReference Include="System.Runtime" Version="4.3.1" />
</ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<!-- <Nullable>enable</Nullable> -->
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.10">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.10" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.25.0" />
<FrameworkReference Include="Microsoft.NETCore.App" />
<PackageReference Include="System.Runtime" Version="4.3.1" />
</ItemGroup>

</Project>
@Henkypenky @tebeco
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
scac
scacOP2y ago
because I could not use DateOnly without them. Maybe I don't need both but definitely one of them.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
scac
scacOP2y ago
Yeah. But I could not use DateOnly. As soon as I added those lines it worked. I removed them and it's still working. So strange. It would not recognize DateOnly before at all
Denis
Denis2y ago
I've had a similar experience when records were introduced
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
scac
scacOP2y ago
I see. Thanks. I don't understand why adding it and then removing it fixed it.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
scac
scacOP2y ago
Hmm. When I added it. I wasn't even running the app. As soon as I added the lines the error underline disppaeared from DateOnly
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
scac
scacOP2y ago
I know. But I did absolutely nothing other than adding the lines.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
scac
scacOP2y ago
Ok, yeah that might be it. This was on VSCode though
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
scac
scacOP2y ago
Got it. Thanks for the info
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
scac
scacOP2y ago
Makes sense.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
scac
scacOP2y ago
Ok. I'll have to spend a few minutes reading this. Thanks
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server