-
-
Notifications
You must be signed in to change notification settings - Fork 801
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
Should Moq stop targeting .NET Standard in favor of .NET Core? #630
Comments
Just a thought If any users have installed Moq, and NuGet decided to add references to the .NET Standard dlls, then they may have to re-install the package with I just checked our projects, and they reference the correct According to NuGet Docs - Matching assembly versions and the target framework in a project
Hopefully everyone is already referencing the correct I remember having an issue with EF, when they did some target changes which forced us to reinstall the NuGet package using |
@michal-ciechan - I'm not sure I understand. You seem to be implying that no longer targeting .NET Standard would have the nice side effect of making it impossible for NuGet to sometimes pick inappropriate DLLs... is that what you were trying to say or am I misinterpreting you? |
I guess that .NET Standard is more abstract/portable implementation and can be used in all .NET implementations rather than .NET Core Library which is more specific. https://docs.microsoft.com/en-us/dotnet/standard/net-standard |
@tomchavakis - please see the quote in the (*) footnote in the first post above, and the linked issue on dotnet/corefx. The thing is that System.Reflection.Emit (which Moq depends on) made it into .NET Standard by accident... it is only functional on .NET Framework & Mono & .NET Core so it would be more honest and potentially less misleading to target these platforms directly. |
rather than targeting .netcore, I think the path forward is to multi-target .netcore AND net461. |
@kzu, understood, I wasn't about to abandon the .NET Framework. Is |
Well, net45 isn't even a supported .NET runtime anymore, is it?
|
@kzu - No, .NET 4.5 is no longer supported. But regarding my question, that isn't actually relevant. Take What I am really worried about is that targeting I have no idea whether this problem still persists or whether it has been fixed in the meantime, but I am not anxious to repeat this ordeal. Also, not everyone is running the latest version of everything (though with the way how .NET has "progressed" over the last couple of years, that has become more or less a requirement if one wants to stay sane. 😜) Because of the above, I was wondering whether it might be safer to keep targeting an earlier version of the .NET Framework (e.g. |
Well, to make matters worse, on the next version of VS, I'm getting an error saying even |
According to this Twitter thread, the documentation isn't updated, but all libraries should target netstandard2.0 in addition to lower standards (if supported) to minimize dependency hell for users of the library: https://twitter.com/davidfowl/status/1025434242832945154 If Moq had a target for .NET Standard 2.0, I probably wouldn't get this long update list by installing Moq into an XUnit test project targeting netcoreapp2.1: |
@eloekset: Yes, targeting .NET Core or Standard 2.0 should result in much fewer dependencies. Apart from that, see #630 (comment) |
Based on these references:
I assume the way forward is to keep a .NET Standard target, after all. Given the information in the cross-platform targeting guide linked above, Moq should probably keep its current targets ( |
Closing this, since it's pretty clear from the reactions to the posts above, as well as from the new information that's become available recently, that .NET Standard support in Moq is a wanted feature. |
.NET Standard 2.0 is in, however I've decided to drop .NET Standard 1.3. There doesn't appear to be much point in keeping it:
|
There's a discussion over at castleproject/Core#374 (triggered by https://github.com/dotnet/corefx/issues/29365#issuecomment-385102487) whether Castle.Core should stop targeting .NET Standard in favor of targeting .NET Core directly. Since Moq relies on Castle.Core, we'd have to do the same as long as we want to keep using the latest versions of DynamicProxy.
This discussion is a good one to have independently from Castle.Core also, since Moq too has a direct dependency on the unlisted(*)
System.Reflection.Emit
package (in order to be able to mock delegates). I am personally in favor of abandoning .NET Standard for the reasons given in castleproject/Core#374 (comment). (Also, we had some reports in the past asking why Moq doesn't work on some platforms, even though they supposedly implement .NET Standard. That confusion could have been avoided by not targeting .NET Standard in the first place.)What are some significant disadvantages of targeting
netcoreappX.Y
instead ofnetstandard1.3
, apart from possibly disgruntling our user base?/cc @kzu
(*) The package has been relisted—citing from https://github.com/dotnet/corefx/issues/29365#issuecomment-398130364 (with emphasis added by me):
The text was updated successfully, but these errors were encountered: