Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
schnerring opened this issue Dec 8, 2023 · 13 comments · Fixed by #4773

Comments

@schnerring
Copy link

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
Copy link

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

@olegd-superoffice
Copy link
Contributor

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

@fretje
Copy link

fretje commented Jan 3, 2024

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

@jaminman
Copy link

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

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

@miaooss
Copy link

miaooss commented Jan 23, 2024

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
Copy link

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 added a commit to olegd-superoffice/NSwag that referenced this issue Feb 8, 2024
Condition expression evaluation resulted in error when NSwagGenerateExceptionClasses is not defined.
Fixes RicoSuter#4633
olegd-superoffice added a commit to olegd-superoffice/NSwag that referenced this issue Feb 8, 2024
Condition expression evaluation resulted in error when NSwagGenerateExceptionClasses is not defined.
Fixes RicoSuter#4633
@olegd-superoffice
Copy link
Contributor

#4773 should fix this when merged.

@jorismathijssen
Copy link

jorismathijssen commented Feb 16, 2024

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
Copy link

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
Copy link

jmevel commented Mar 13, 2024

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.

RicoSuter pushed a commit that referenced this issue Mar 14, 2024
Condition expression evaluation resulted in error when NSwagGenerateExceptionClasses is not defined.
Fixes #4633
@miaooss
Copy link

miaooss commented Mar 18, 2024

What will be the release number for this one ?

@sdet2178
Copy link

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
Copy link
Contributor

This is still partly broken, see #4890.

lahma pushed a commit to lahma/NSwag that referenced this issue Jun 13, 2024
Condition expression evaluation resulted in error when NSwagGenerateExceptionClasses is not defined.
Fixes RicoSuter#4633
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.