bchavez / Bogus

:card_index: A simple fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js.
Other
8.51k stars 483 forks source link

.NET 8 support #531

Closed felipementel closed 5 months ago

felipementel commented 5 months ago

Is there any prediction on when the package will support .NET 8?

bchavez commented 5 months ago

What specifically about .NET 8 needs to be supported?

DateOnly and TimeOnly types were introduced in .NET 6 and there's a .NET 6 TFM distribution already to support those types:

https://github.com/bchavez/Bogus/blob/55bde49ca231fa7f3df16cfbd60bc122ebc50825/Source/Bogus/Bogus.csproj#L8

IIRC, from a consumer standpoint, any net8.0 TFM application you create automatically uses Bogus' net6.0 TFM distribution.

felipementel commented 5 months ago

@bchavez sorry for late comment, I was travel

When I try to add the Bogus library to my .net 8 project, this happen:

╰─❯ dotnet add package Bogus

Determining projects to restore... Writing C:\Users\felipe.augusto\AppData\Local\Temp\tmpxcgl2d.tmp info : X.509 certificate chain validation will use the default trust store selected by .NET for code signing. info : X.509 certificate chain validation will use the default trust store selected by .NET for timestamping. info : Adding PackageReference for package 'Bogus' into project 'C:\Proj\DEPLOY\DEPLOY.EntityFramwork.Analize.v1\src\DEPLOY.EntityFramework.v1\DEPLOY.EntityFramework.v1.csproj'. info : GET https://api.nuget.org/v3/registration5-gz-semver2/bogus/index.json info : OK https://api.nuget.org/v3/registration5-gz-semver2/bogus/index.json 155ms info : GET https://api.nuget.org/v3/registration5-gz-semver2/bogus/page/2.1.4/18.0.1.json info : OK https://api.nuget.org/v3/registration5-gz-semver2/bogus/page/2.1.4/18.0.1.json 167ms info : GET https://api.nuget.org/v3/registration5-gz-semver2/bogus/page/18.0.2/31.0.3.json info : OK https://api.nuget.org/v3/registration5-gz-semver2/bogus/page/18.0.2/31.0.3.json 155ms info : GET https://api.nuget.org/v3/registration5-gz-semver2/bogus/page/32.0.1/35.4.0.json
info : OK https://api.nuget.org/v3/registration5-gz-semver2/bogus/page/32.0.1/35.4.0.json 161ms info : Restoring packages for C:\Proj\DEPLOY\DEPLOY.EntityFramwork.Analize.v1\src\DEPLOY.EntityFramework.v1\DEPLOY.EntityFramework.v1.csproj... error: NU1100: Unable to resolve 'Bogus (>= 35.4.0)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: nuget.org. <------- this message is important !!! info : GET https://api.nuget.org/v3/vulnerabilities/index.json info : OK https://api.nuget.org/v3/vulnerabilities/index.json 65ms info : GET https://api.nuget.org/v3-vulnerabilities/2024.02.14.05.49.15/vulnerability.base.json info : GET https://api.nuget.org/v3-vulnerabilities/2024.02.14.05.49.15/2024.02.15.11.21.40/vulnerability.update.json info : OK https://api.nuget.org/v3-vulnerabilities/2024.02.14.05.49.15/vulnerability.base.json 16ms info : OK https://api.nuget.org/v3-vulnerabilities/2024.02.14.05.49.15/2024.02.15.11.21.40/vulnerability.update.json 34ms error: Package 'Bogus' is incompatible with 'all' frameworks in project 'C:\Proj\DEPLOY\DEPLOY.EntityFramwork.Analize.v1\src\DEPLOY.EntityFramework.v1\DEPLOY.EntityFramework.v1.csproj'.
╭─ pwsh  C:\Proj\DEPLOY\DEPLOY.EntityFramwork.Analize.v1\src\DEPLOY.EntityFramework.v1   main ?1 ~1

and the csproj is:

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="EntityFramework" Version="6.4.4" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.1">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.1" />
  </ItemGroup>

</Project>
bchavez commented 5 months ago

@felipementel Looks like it works fine here:

image

bchavez commented 5 months ago

> error: NU1100: Unable to resolve 'Bogus (>= 35.4.0)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: nuget.org. <------- this message is important !!!

Yes, I do think the message is important.

You probably want to check your NuGet.config (and any project directory tree .configs or Directory.Build.props/targets ) for anything obscure or custom PackageSourceMappings because the error message says "nuget.org was not considered for resolving the Bogus package" it seems.

felipementel commented 5 months ago

> error: NU1100: Unable to resolve 'Bogus (>= 35.4.0)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: nuget.org. <------- this message is important !!!

Yes, I do think the message is important.

You probably want to check your NuGet.config (and any project directory tree .configs or Directory.Build.props/targets ) for anything obscure or custom PackageSourceMappings because the error message says "nuget.org was not considered for resolving the Bogus package" it seems.

Thanks to answer!

At nuget.org website, don't have a support to .NET 8

image

I will continue to try to install the package

digitalcoyote commented 5 months ago

After .Net 5.0 the .Net Standard was replaced with just .Net x.0. NuGet.org listing .Net 6.0 means that it supports .Net 6.0+, but this specific package may not take advantage of some .Net 7.0+ features.

I've been using Bogus.Net in a couple .Net 7.0 and .Net 8.0 projects.

See: https://devblogs.microsoft.com/dotnet/the-future-of-net-standard/

felipementel commented 5 months ago

image

Everything is fine!

bchavez commented 5 months ago

Yes, I think @digitalcoyote is absolutely correct ^; this was my understanding too.

Cool, @felipementel very glad you got the problem sorted out. Was it a problem with your NuGet.config?

felipementel commented 4 months ago

Yes, I think @digitalcoyote is absolutely correct ^; this was my understanding too.

Cool, @felipementel very glad you got the problem sorted out. Was it a problem with your NuGet.config?

hello @bchavez , Those steps to add your package at Package Source Mapping. At step 3, I type "Bogus*" and click ate step 5

image