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

Project condition for IsTrimmable is incorrect #188

Closed
7 tasks done
hwoodiwiss opened this issue Feb 3, 2024 · 1 comment · Fixed by #187
Closed
7 tasks done

Project condition for IsTrimmable is incorrect #188

hwoodiwiss opened this issue Feb 3, 2024 · 1 comment · Fixed by #187
Labels

Comments

@hwoodiwiss
Copy link
Contributor

hwoodiwiss commented Feb 3, 2024

Current Behaviour

Currently IsTrimmable is not set on a number of the Microsoft.Kiota .NET libraries as they share this incorrect condition:

<PropertyGroup Condition="'$(TargetFrameworkVersion)' == 'net5.0'">  
  <IsTrimmable>true</IsTrimmable>
</PropertyGroup>

Expected Behaviour

I would expect build errors when non-trim-safe code as added to the libraries.

Fix

The property group condition should be changed to:

<PropertyGroup Condition="'$(TargetFramework)' == 'net5.0'">  
  <IsTrimmable>true</IsTrimmable>
</PropertyGroup>

Which causes the IsTrimmable property to be correctly set, and any expected trimming related compilation failures to occur.

I've found this issue in these projects:

@baywet
Copy link
Member

baywet commented Feb 4, 2024

For additional context: while the property being used exists in some contexts it seems it wasn't the right one https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#targetframework

Additional evidence
https://www.aloneguid.uk/posts/2022/08/csproj-condition-cheat-sheet/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants