dotnet / roslyn-analyzers

MIT License
1.6k stars 468 forks source link

Publish Microsoft.CodeAnalysis.ResxSourceGenerator to nuget.org #6044

Open AraHaan opened 2 years ago

AraHaan commented 2 years ago

It would be nice if Microsoft.CodeAnalysis.ResxSourceGenerator was available in nuget.org so projects that do not want to add the dotnet7 or the dotnet-tools feeds can still use the generator.

JoeRobich commented 2 years ago

Is NuGet the right distribution mechanism for this? Should this just be part of the SDK?

AraHaan commented 2 years ago

Either one could work, yeah (or both for those using the .NET 6 SDK like me with their codes and need the generator from this repo).

AraHaan commented 2 years ago

I think that the SDK would actually be better since I now see the package is gone from nuget.org now.

I can only find it in the dotnet6 feed, however it's an 3.3.3-beta version that has not been updated since 2021.

Youssef1313 commented 1 year ago

Do we want to rewrite it as an incremental generator (and require 4.x the package)?

AraHaan commented 1 year ago

If it becomes built into the .NET SDK I think rewriting it to make it incremental would be a must.

Bonus Points: If there could be support added for reading binary resources as byte[] and then anyone needing to read them into things like Icon or Image would have to make the conversion themselves (which would be a small price to pay to allow loading of binary resources cross platform).

bitbonk commented 1 year ago

As mentioned in #5521, it would be helpful if there is also a nullable-enabled replacement for PublicResXFileCodeGenerator. As of now, it seems that Microsoft.CodeAnalysis.ResxSourceGenerator cannot produce public properties but there are fairly common scenarios where this is needed.

So either make Microsoft.CodeAnalysis.ResxSourceGenerator configurable or add a Microsoft.CodeAnalysis.PublicResxSourceGenerator.

sharwell commented 1 year ago

It's currently being published to the dotnet8 feed. I don't have an idea for when it would appear on nuget.org.

it seems that Microsoft.CodeAnalysis.ResxSourceGenerator cannot produce public properties

Can you file a separate issue for this?

AraHaan commented 1 year ago

Honestly to nuget.org or to the .NET SDK as a built in source generator would work as well (or better yet do both so non-SDK style projects can use them as well in VS2022).

bitbonk commented 1 year ago

In a world where nullability is enabled by default it feels somewhat archaic to use these old ResxGenerator and PublicResxGenerator that produce code without any nullability annotations. There should be a way to generate nullable annotated resources that is as easy as it now with the old ones.