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

Suggest adding PolySharp #79

Closed
lilith opened this issue Jan 30, 2024 · 4 comments
Closed

Suggest adding PolySharp #79

lilith opened this issue Jan 30, 2024 · 4 comments
Labels
enhancement New feature or request PR welcome User contribution/PR is welcome

Comments

@lilith
Copy link
Contributor

lilith commented Jan 30, 2024

I've recently migrated most of my nuget packages / oss projects to using PolySharp - I can set language=latest and still target .NET Standard 2.0 - it's great.
It's particularly essential for .NET 8 features, such as annotating for trimming/etc.

In Tomlyn.props, add

<PolySharpIncludeRuntimeSupportedAttributes>true</PolySharpIncludeRuntimeSupportedAttributes>

And

    <!--Polyfill language features for .NET Standard 2.0 et all, generating internal
        items only for the compiler. Enables langversion=latest-->
    <PackageReference Include="PolySharp" Version="1.*">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>

The only issue I've had with the library is that since it generates internal stuff, InternalsVisibleTo can cause duplications if there is both a mismatch on targeted frameworks and the consuming (typically unit test) project also includes it unnecessarily. Easily avoided, though.

@xoofx xoofx added enhancement New feature or request PR welcome User contribution/PR is welcome labels Jan 31, 2024
@xoofx
Copy link
Owner

xoofx commented Jan 31, 2024

I've recently migrated most of my nuget packages / oss projects to using PolySharp - I can set language=latest and still target .NET Standard 2.0 - it's great.

Agreed. Feel free to open a PR.

@lilith
Copy link
Contributor Author

lilith commented Jan 31, 2024

I can do that. Could you merge or review my current one?

@xoofx
Copy link
Owner

xoofx commented Jan 31, 2024

I can do that. Could you merge or review my current one?

Oops, sorry, I retriggered the pipeline but forgot to come back to check and merge, done! 😅

@lilith
Copy link
Contributor Author

lilith commented Jan 31, 2024

#81

@lilith lilith mentioned this issue Feb 1, 2024
@xoofx xoofx closed this as completed in 57ff413 Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PR welcome User contribution/PR is welcome
Projects
None yet
Development

No branches or pull requests

2 participants