Prefer .NET Standard 2.0 library reference over .NET 4.5.1 from a .NET 4.7.2 project












0















I have an old-style C# WPF project file. It is a .NET Framework 4.7.2 project. I want to reference a NuGet library that has builds for .NET Standard 2.0 and .NET Framework 4.5.1. An example of this would be morelinq.



As I understand it, .NET Framework 4.7.2 fully implements the .NET Standard 2.0 API. Therefore I would like my project to reference the .NET Standard 2.0 build in the NuGet package instead of the .NET Framework 4.5.1 build. The benefit of this would be that the .NET Standard 2.0 version of morelinq does not have additional dependencies, e.g. on System.ValueTuple.



However, when I add the NuGet package, it defaults to referencing the .NET Framework 4.5.1 build and hence, includes its additional dependencies.



This is only one of a few such cases. So at the moment it seems, to me at least, that I'm references many unnecessary additional dependencies that could be avoided.



(My apologies if this is a duplicate. I did try searching first.)










share|improve this question

























  • ...does not have additional dependencies, e.g. on System.ValueTuple. It does. However, it is prepackaged in the .NET Standard library.

    – Patrick Hofman
    Nov 21 '18 at 8:06













  • @PatrickHofman Ok, so that's a matter of phrasing. I would like to use the prepackaged versions, as .NET 4.7.2 is .NET Standard 2.0 compliant.

    – Francois Botha
    Nov 21 '18 at 8:39











  • Ok, then I misunderstood what is meant by .NET 4.7.2 is .NET Standard 2.0 compliant.

    – Francois Botha
    Nov 21 '18 at 9:02






  • 1





    Patrick's comment causes too much confusion, there is no such thing as a ".netstandard app". The term only applies to libraries, dlls. The app that uses the library, the exe, must always target a specific platform. Otherwise easy to see when you create such an app in VS, no way to pick it. You should not favor a .netstandard library in a desktop app when a desktop library is available. The runtime hoochie-moochie that is required to forward types from the reference assembly to the runtime assembly is not for free.

    – Hans Passant
    Nov 21 '18 at 9:13






  • 1





    Adding to Hans' comment, I think that "many unnecessary additional dependencies" is somewhat smoke and mirrors. If you use NuGet at all then the difference between "It depends on netstandard20" and "It depends on 20 small packages" is not a meaningful difference. I can see that the appearance of a single dependency feels tidier, but it's more appearance that reality

    – Chris F Carroll
    Nov 21 '18 at 9:42
















0















I have an old-style C# WPF project file. It is a .NET Framework 4.7.2 project. I want to reference a NuGet library that has builds for .NET Standard 2.0 and .NET Framework 4.5.1. An example of this would be morelinq.



As I understand it, .NET Framework 4.7.2 fully implements the .NET Standard 2.0 API. Therefore I would like my project to reference the .NET Standard 2.0 build in the NuGet package instead of the .NET Framework 4.5.1 build. The benefit of this would be that the .NET Standard 2.0 version of morelinq does not have additional dependencies, e.g. on System.ValueTuple.



However, when I add the NuGet package, it defaults to referencing the .NET Framework 4.5.1 build and hence, includes its additional dependencies.



This is only one of a few such cases. So at the moment it seems, to me at least, that I'm references many unnecessary additional dependencies that could be avoided.



(My apologies if this is a duplicate. I did try searching first.)










share|improve this question

























  • ...does not have additional dependencies, e.g. on System.ValueTuple. It does. However, it is prepackaged in the .NET Standard library.

    – Patrick Hofman
    Nov 21 '18 at 8:06













  • @PatrickHofman Ok, so that's a matter of phrasing. I would like to use the prepackaged versions, as .NET 4.7.2 is .NET Standard 2.0 compliant.

    – Francois Botha
    Nov 21 '18 at 8:39











  • Ok, then I misunderstood what is meant by .NET 4.7.2 is .NET Standard 2.0 compliant.

    – Francois Botha
    Nov 21 '18 at 9:02






  • 1





    Patrick's comment causes too much confusion, there is no such thing as a ".netstandard app". The term only applies to libraries, dlls. The app that uses the library, the exe, must always target a specific platform. Otherwise easy to see when you create such an app in VS, no way to pick it. You should not favor a .netstandard library in a desktop app when a desktop library is available. The runtime hoochie-moochie that is required to forward types from the reference assembly to the runtime assembly is not for free.

    – Hans Passant
    Nov 21 '18 at 9:13






  • 1





    Adding to Hans' comment, I think that "many unnecessary additional dependencies" is somewhat smoke and mirrors. If you use NuGet at all then the difference between "It depends on netstandard20" and "It depends on 20 small packages" is not a meaningful difference. I can see that the appearance of a single dependency feels tidier, but it's more appearance that reality

    – Chris F Carroll
    Nov 21 '18 at 9:42














0












0








0








I have an old-style C# WPF project file. It is a .NET Framework 4.7.2 project. I want to reference a NuGet library that has builds for .NET Standard 2.0 and .NET Framework 4.5.1. An example of this would be morelinq.



As I understand it, .NET Framework 4.7.2 fully implements the .NET Standard 2.0 API. Therefore I would like my project to reference the .NET Standard 2.0 build in the NuGet package instead of the .NET Framework 4.5.1 build. The benefit of this would be that the .NET Standard 2.0 version of morelinq does not have additional dependencies, e.g. on System.ValueTuple.



However, when I add the NuGet package, it defaults to referencing the .NET Framework 4.5.1 build and hence, includes its additional dependencies.



This is only one of a few such cases. So at the moment it seems, to me at least, that I'm references many unnecessary additional dependencies that could be avoided.



(My apologies if this is a duplicate. I did try searching first.)










share|improve this question
















I have an old-style C# WPF project file. It is a .NET Framework 4.7.2 project. I want to reference a NuGet library that has builds for .NET Standard 2.0 and .NET Framework 4.5.1. An example of this would be morelinq.



As I understand it, .NET Framework 4.7.2 fully implements the .NET Standard 2.0 API. Therefore I would like my project to reference the .NET Standard 2.0 build in the NuGet package instead of the .NET Framework 4.5.1 build. The benefit of this would be that the .NET Standard 2.0 version of morelinq does not have additional dependencies, e.g. on System.ValueTuple.



However, when I add the NuGet package, it defaults to referencing the .NET Framework 4.5.1 build and hence, includes its additional dependencies.



This is only one of a few such cases. So at the moment it seems, to me at least, that I'm references many unnecessary additional dependencies that could be avoided.



(My apologies if this is a duplicate. I did try searching first.)







c# .net nuget morelinq






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 9:05







Francois Botha

















asked Nov 21 '18 at 8:02









Francois BothaFrancois Botha

1,9191722




1,9191722













  • ...does not have additional dependencies, e.g. on System.ValueTuple. It does. However, it is prepackaged in the .NET Standard library.

    – Patrick Hofman
    Nov 21 '18 at 8:06













  • @PatrickHofman Ok, so that's a matter of phrasing. I would like to use the prepackaged versions, as .NET 4.7.2 is .NET Standard 2.0 compliant.

    – Francois Botha
    Nov 21 '18 at 8:39











  • Ok, then I misunderstood what is meant by .NET 4.7.2 is .NET Standard 2.0 compliant.

    – Francois Botha
    Nov 21 '18 at 9:02






  • 1





    Patrick's comment causes too much confusion, there is no such thing as a ".netstandard app". The term only applies to libraries, dlls. The app that uses the library, the exe, must always target a specific platform. Otherwise easy to see when you create such an app in VS, no way to pick it. You should not favor a .netstandard library in a desktop app when a desktop library is available. The runtime hoochie-moochie that is required to forward types from the reference assembly to the runtime assembly is not for free.

    – Hans Passant
    Nov 21 '18 at 9:13






  • 1





    Adding to Hans' comment, I think that "many unnecessary additional dependencies" is somewhat smoke and mirrors. If you use NuGet at all then the difference between "It depends on netstandard20" and "It depends on 20 small packages" is not a meaningful difference. I can see that the appearance of a single dependency feels tidier, but it's more appearance that reality

    – Chris F Carroll
    Nov 21 '18 at 9:42



















  • ...does not have additional dependencies, e.g. on System.ValueTuple. It does. However, it is prepackaged in the .NET Standard library.

    – Patrick Hofman
    Nov 21 '18 at 8:06













  • @PatrickHofman Ok, so that's a matter of phrasing. I would like to use the prepackaged versions, as .NET 4.7.2 is .NET Standard 2.0 compliant.

    – Francois Botha
    Nov 21 '18 at 8:39











  • Ok, then I misunderstood what is meant by .NET 4.7.2 is .NET Standard 2.0 compliant.

    – Francois Botha
    Nov 21 '18 at 9:02






  • 1





    Patrick's comment causes too much confusion, there is no such thing as a ".netstandard app". The term only applies to libraries, dlls. The app that uses the library, the exe, must always target a specific platform. Otherwise easy to see when you create such an app in VS, no way to pick it. You should not favor a .netstandard library in a desktop app when a desktop library is available. The runtime hoochie-moochie that is required to forward types from the reference assembly to the runtime assembly is not for free.

    – Hans Passant
    Nov 21 '18 at 9:13






  • 1





    Adding to Hans' comment, I think that "many unnecessary additional dependencies" is somewhat smoke and mirrors. If you use NuGet at all then the difference between "It depends on netstandard20" and "It depends on 20 small packages" is not a meaningful difference. I can see that the appearance of a single dependency feels tidier, but it's more appearance that reality

    – Chris F Carroll
    Nov 21 '18 at 9:42

















...does not have additional dependencies, e.g. on System.ValueTuple. It does. However, it is prepackaged in the .NET Standard library.

– Patrick Hofman
Nov 21 '18 at 8:06







...does not have additional dependencies, e.g. on System.ValueTuple. It does. However, it is prepackaged in the .NET Standard library.

– Patrick Hofman
Nov 21 '18 at 8:06















@PatrickHofman Ok, so that's a matter of phrasing. I would like to use the prepackaged versions, as .NET 4.7.2 is .NET Standard 2.0 compliant.

– Francois Botha
Nov 21 '18 at 8:39





@PatrickHofman Ok, so that's a matter of phrasing. I would like to use the prepackaged versions, as .NET 4.7.2 is .NET Standard 2.0 compliant.

– Francois Botha
Nov 21 '18 at 8:39













Ok, then I misunderstood what is meant by .NET 4.7.2 is .NET Standard 2.0 compliant.

– Francois Botha
Nov 21 '18 at 9:02





Ok, then I misunderstood what is meant by .NET 4.7.2 is .NET Standard 2.0 compliant.

– Francois Botha
Nov 21 '18 at 9:02




1




1





Patrick's comment causes too much confusion, there is no such thing as a ".netstandard app". The term only applies to libraries, dlls. The app that uses the library, the exe, must always target a specific platform. Otherwise easy to see when you create such an app in VS, no way to pick it. You should not favor a .netstandard library in a desktop app when a desktop library is available. The runtime hoochie-moochie that is required to forward types from the reference assembly to the runtime assembly is not for free.

– Hans Passant
Nov 21 '18 at 9:13





Patrick's comment causes too much confusion, there is no such thing as a ".netstandard app". The term only applies to libraries, dlls. The app that uses the library, the exe, must always target a specific platform. Otherwise easy to see when you create such an app in VS, no way to pick it. You should not favor a .netstandard library in a desktop app when a desktop library is available. The runtime hoochie-moochie that is required to forward types from the reference assembly to the runtime assembly is not for free.

– Hans Passant
Nov 21 '18 at 9:13




1




1





Adding to Hans' comment, I think that "many unnecessary additional dependencies" is somewhat smoke and mirrors. If you use NuGet at all then the difference between "It depends on netstandard20" and "It depends on 20 small packages" is not a meaningful difference. I can see that the appearance of a single dependency feels tidier, but it's more appearance that reality

– Chris F Carroll
Nov 21 '18 at 9:42





Adding to Hans' comment, I think that "many unnecessary additional dependencies" is somewhat smoke and mirrors. If you use NuGet at all then the difference between "It depends on netstandard20" and "It depends on 20 small packages" is not a meaningful difference. I can see that the appearance of a single dependency feels tidier, but it's more appearance that reality

– Chris F Carroll
Nov 21 '18 at 9:42












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53407579%2fprefer-net-standard-2-0-library-reference-over-net-4-5-1-from-a-net-4-7-2-pro%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53407579%2fprefer-net-standard-2-0-library-reference-over-net-4-5-1-from-a-net-4-7-2-pro%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

RAC Tourist Trophy