dotless / dotless

.NET Port of the ruby Less CSS lib
http://www.dotlesscss.org
Apache License 2.0
694 stars 202 forks source link

MethodNotFoundException at net461 target #567

Open twirpx opened 5 years ago

twirpx commented 5 years ago

In following commit:

https://github.com/dotless/dotless/commit/58095fd90ebd0da4e7bea06bbf496fe765caf469#diff-23edb77dc293d7b20cc8efaabd553e9a

Dependency on Microsoft.Extensions.DependencyInjection for net461 was changed from 2.0.0 to 1.1.1 Why???

Well now running app after upgrade dotless from 1.6.5 to 1.6.6+ gives following exception:

System.MissingMethodException: Method not found: 'System.IServiceProvider Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider (Microsoft.Extensions.DependencyInjection.IServiceCollection)'. at dotless.Core.ContainerFactory.GetContainer(DotlessConfiguration configuration) at dotless.Core.EngineFactory.GetEngine(ContainerFactory containerFactory) at dotless.Core.Less.Parse(String less, DotlessConfiguration config) at ...

This happens because return value of this method was changed in following commit https://github.com/aspnet/DependencyInjection/commit/a0467de767febbf86b7d401abe012da8434fa7d7#diff-e2d2f137092a305455ceba873ddd962a and thus downgrade from 2.0.0+ to 1.1.1 ruins compatibility in binary assembly.

jcchalte commented 5 years ago

Any news about this ? We have the same issue here, upgrading to a recent version of dotless (1.6.7 in our car) and Microsoft.Extensions.DependencyInjection (>2.0) breaks Less compilation primitives :(

CZEMacLeod commented 5 years ago

Why is there a split for V1.1.1 or V2.1.1 depending on framework v4.6.1 vs 4.7.0 ? This is causing me difficulty as we have an ASP.Net 4.6.1 project using Microsoft.Extensions.DependencyInjection which is causing conflicts.

calculuswhiz commented 3 years ago

Well, it seems the only way around this is to go to Framework v4.7.0... Very strange that it changes depending on framework version.

CZEMacLeod commented 3 years ago

@calculuswhiz Indeed - I don't know why the dependency versions were split like this. I assume it was for backwards compatibility reasons, although it would have been better to fork the package or something. All versions of Microsoft.Extensions.DependencyInjection, even the latest 6.0.0-preview4 support net461 as a target so it is not for that. Regardless, I ended up multitargeting my packages/projects across the net461/net47 split until I managed to update our full stack to net472 or later.