RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.78k stars 1.29k forks source link

NSwag.AspNetCore has an upper version limit for Microsoft.Extensions.FileProviders.Embedded #4638

Closed paulomorgado closed 10 months ago

paulomorgado commented 11 months ago

NSwag.AspNetCore has an upper version limit for Microsoft.Extensions.FileProviders.Embedded.

Is there a reason for that?

As it is, NSwag.AspNetCore is causing a NU1608 on projects targeting .NET 8.0.

RicoSuter commented 10 months ago

Not sure, can you create a PR to fix it?

paulomorgado commented 10 months ago

The use of a NuSpec file is intended or legacy?

Can we move that to using dotnet pack/msbuild -t:pack?

lahma commented 10 months ago

I think using csproj to guide pack is always better, as long as the output is identical.

El-Gor-do commented 10 months ago

NSwag.AspNetCore also depends on NSwag.Generation.AspNetCore which has upper limits on Microsoft.Extensions.DependencyInjection.Abstractions and Microsoft.Extensions.Options. Can these upper limits also be removed?

paulomorgado commented 10 months ago

Just created #4642 to remove the upper limits.

The usage of NuGet MSBuild targets to produce the packages will be addressed in a later PR.

dougclutter commented 10 months ago

Trying to upgrade our .NET 7 site to .NET 8 and we're running into this limit too. Is there any way to work around this until a fix is released?

paulomorgado commented 10 months ago

Can you try adding a NoWarn to the PackageReference?

 <PackageReference Include="NSwag.AspNetCore" Version="13.20.0">
   <NoWarn>NU1608</NoWarn>
 </PackageReference>
dougclutter commented 10 months ago

@paulomorgado - Thanks for sharing that snippet but it didn't work for me.

Here's what I ended up with:

    <PropertyGroup>
        <NoWarn>1701;1702;CA2007</NoWarn>
    </PropertyGroup>

    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
        <DefineConstants>DEBUG;TRACE</DefineConstants>
    </PropertyGroup>

    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
        <NoWarn>$(NoWarn);NU1608</NoWarn>
        <GenerateDocumentationFile>true</GenerateDocumentationFile>
        <TreatWarningsAsErrors>true</TreatWarningsAsErrors>     
    </PropertyGroup>

Just posting it here in case it helps someone else.

arakis commented 10 months ago

I get NU1107, and i'm unable to supress it via NoWarn:

MyProject.csproj : error NU1107: Version conflict detected for Microsoft.Extensions.FileProviders.Embedded. Install/reference Microsoft.Extensions.FileProviders.Embedded 8.0.0 directly to project MyProject to resolve this issue. 
MyProject.csproj : error NU1107:  MyProject -> AnotherProject1 -> AnotherProject2 -> AnotherProject3 -> Microsoft.Extensions.FileProviders.Embedded (>= 8.0.0) 
MyProject.csproj : error NU1107:  MyProject -> NSwag.AspNetCore 13.20.0 -> Microsoft.Extensions.FileProviders.Embedded (>= 7.0.0 && < 8.0.0).

Can sombody please make a pre-prerelease? The latest nuget pre-release is 14.0.0-preview12, but latest git tag is 14.0.0-preview14.

paulomorgado commented 10 months ago

Yeah! Some NuGet warnings are hard or impossible to suppress.

Maybe you can find some help at https://github.com/NuGet/Home/discussions.