NSwag icon indicating copy to clipboard operation
NSwag copied to clipboard

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

Open schnerring opened this issue 1 year ago • 8 comments

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)".

schnerring avatar Dec 08 '23 23:12 schnerring

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

Berthelmaster avatar Dec 22 '23 11:12 Berthelmaster

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

olegd-superoffice avatar Jan 03 '24 10:01 olegd-superoffice

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

fretje avatar Jan 03 '24 16:01 fretje

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

  <PropertyGroup>
    <NSwagGenerateExceptionClasses>true</NSwagGenerateExceptionClasses>
  </PropertyGroup>

jaminman avatar Jan 18 '24 23:01 jaminman

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

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

miaooss avatar Jan 23 '24 20:01 miaooss

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.

Lindsay-Mathieson avatar Feb 07 '24 01:02 Lindsay-Mathieson

#4773 should fix this when merged.

olegd-superoffice avatar Feb 08 '24 10:02 olegd-superoffice

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

jorismathijssen avatar Feb 16 '24 14:02 jorismathijssen

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?

sdet2178 avatar Mar 12 '24 14:03 sdet2178

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.

jmevel avatar Mar 13 '24 08:03 jmevel

What will be the release number for this one ?

miaooss avatar Mar 18 '24 18:03 miaooss

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?

sdet2178 avatar Mar 28 '24 12:03 sdet2178

This is still partly broken, see #4890.

bkoelman avatar May 12 '24 10:05 bkoelman