trullock / NUglify

NUglify is a HTML, JavaScript and CSS minification Library for .NET (fork of AjaxMin + new features)
Other
394 stars 78 forks source link

.NET 6 ambiguity with System.Linq.Enumerable.DistinctBy #268

Closed Stryxus closed 3 years ago

Stryxus commented 3 years ago

With .NET 6 right around the corner, I started using it due to its improvements and LTS status. However, using it with FFMpegCore is not possible and changing the project to .NET 6 creates an ambiguity error between System.Linq.Enumerable.DistinctBy and NUglify.Helpers.NUglifyExtensions.DistincyBy in class https://github.com/trullock/NUglify/blob/master/src/NUglify/Css/CssColorName.cs

trullock commented 3 years ago

Do the two methods do the same thing?

If so add conditional compilation flags for < .net 6 around the nuglify helper

trullock commented 3 years ago

although why are you compiling NUglify yourself into .NET 6?

Stryxus commented 3 years ago

Previously, I changed the project target framework to .NET 5 in NUglify and it worked fine. This is because if a project isn't targeting .NET Standard 2.1 at the very least, .NET 5 and 6 fails to build for the top-most project so I cannot use the pre-builds.

As for the functionality of DistinctBy, I am unsure since I only just discovered its a thing.

trullock commented 3 years ago

Sorry youre gonna have to rewind a bit, what's FFMpegCore relationship to NUglify/what youre doing?

Stryxus commented 3 years ago

Wops, sorry, corrected it, im working with both and a few other things so names are getting a little mixed up.

trullock commented 3 years ago

Can you create a minimal repro of your problem please and share it

Stryxus commented 3 years ago

I will, give me a few minutes.

Stryxus commented 3 years ago

I have made a repo for it. https://github.com/Stryxus/NUglify-NET5-NET6-Testing

Stryxus commented 3 years ago

Seems its more of a wide-spread issue. Interestingly enough when I remove all target frameworks and just target .NET 5, it works fine. Keep in mind, im not an expert in targeting multiple frameworks at once. image

trullock commented 3 years ago

OK, I can take a look at this

However, why do you need to build this to target .NET 5 or 6? Do the existing binaries not work? If not, whats the problem?

trullock commented 3 years ago

Adding net50 to the current set of target frameworks works just fine under VS2019. I'll add this to the codebase, not sure what value it delivers but it wont hurt

trullock commented 3 years ago

And compiling to net60 under VS2022 latest preview also works (the Linq bug not withstanding)

I've pushed a net60 branch which includes both fixes. I'll publish this when net60 is released.

Let me know if you need anything else

Stryxus commented 3 years ago

And compiling to net60 under VS2022 latest preview also works (the Linq bug not withstanding)

I've pushed a net60 branch which includes both fixes. I'll publish this when net60 is released.

Let me know if you need anything else

Thanks this is all I wanted. I personally am not a fan of having to edit submodules each time.

EhtashamBukhari commented 2 years ago

I'm still facing that issue while trying to upgrade to .NET 6.

pawansingh168 commented 1 year ago

I have made a repo for it. https://github.com/Stryxus/NUglify-NET5-NET6-Testing

Not available