RicoSuter / NSwag

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

Expected "%(NSwagGenerateExceptionClasses)" to evaluate to a boolean instead of "", in condition "!%(FirstForGenerator) OR !%(NSwagGenerateExceptionClasses)" when upgrading from `preview010` to `preview012` #4633

Closed schnerring closed 7 months ago

schnerring commented 10 months ago

Inside a project that uses a OpenApiProjectReference to generate a C# client:

<ItemGroup>
    <PackageReference Include="NSwag.ApiDescription.Client" Version="14.0.0-preview012">
        <PrivateAssets>all</PrivateAssets>
        <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <OpenApiProjectReference Include="../MyAPI/MyAPI.csproj">
        <CodeGenerator>NSwagCSharp</CodeGenerator>
        <ClassName>{controller}MyClient</ClassName>
        <Options>/GenerateClientInterfaces:true /GenerateNullableReferenceTypes:true /GenerateNativeRecords:true /ClassStyle:Record /JsonLibrary:SystemTextJson</Options>
    </OpenApiProjectReference>
</ItemGroup>

Running the build on NSwag version 14.0.0-preview012 outputs the following error:

MSB4100 Expected "%(NSwagGenerateExceptionClasses)" to evaluate to a boolean instead of "", in condition "!%(FirstForGenerator) OR !%(NSwagGenerateExceptionClasses)".
Berthelmaster commented 10 months ago

Got this when downgrading from preview012 to preview011 as well :(

olegd-superoffice commented 9 months ago

Temporary workaround for this is to add property to the project explicitly: <NSwagGenerateExceptionClasses>true</NSwagGenerateExceptionClasses> until this is fixed.

fretje commented 9 months ago

This seems to be still an issue in the v14 release...

jaminman commented 9 months ago

I resolved the issue by adding a boolean property NSwagGenerateExceptionClasses in my project file.

  <PropertyGroup>
    <NSwagGenerateExceptionClasses>true</NSwagGenerateExceptionClasses>
  </PropertyGroup>
miaooss commented 9 months ago

The issue seem to be present on the latest build as well

I'm not able to use NSwagGenerateExceptionClasses to fix my issue

Lindsay-Mathieson commented 8 months ago

The issue seem to be present on the latest build as well

I'm not able to use NSwagGenerateExceptionClasses to fix my issue

Present for me as well (NSwag 4.6.1) but NSwagGenerateExceptionClasses works for me.

olegd-superoffice commented 8 months ago

4773 should fix this when merged.

jorismathijssen commented 8 months ago

With /GenerateExceptionClasses:false do i use:

  <PropertyGroup>
    <NSwagGenerateExceptionClasses>false</NSwagGenerateExceptionClasses>
  </PropertyGroup>

It gives me an error with The command "dotnet --roll-forward-on-no-candidate-fx 2...." exited with code -1.

Edit: Found out why, i will just wait for the PR

sdet2178 commented 7 months ago

The issue seems to still exist in the latest version, I tried the work around and didn't work. Is there an estimation for when this will be fixed?

jmevel commented 7 months ago

The issue seems to still exist in the latest version, I tried the work around and didn't work. Is there an estimation for when this will be fixed?

👇

4773 should fix this when merged.

miaooss commented 7 months ago

What will be the release number for this one ?

sdet2178 commented 7 months ago

I tried version 14.0.7 and the build is still broken with this issue: The command "dotnet --roll-forward-on-no-candidate-fx 2 ....exited with code 255 Is there a fix coming for this anytime soon?

bkoelman commented 5 months ago

This is still partly broken, see #4890.