VS2017 - Consolidating Newtonsoft.Json.dll (but it could just as easily be any varied version nuget package)
I’ve a solution with somewhere in the region of 60 projects, most of which use Newtonsoft.Json.dll and many of which reference each other. Things were building nicely, no warnings.
Took a look at the Consolidate feature of the nugget package manager, and it seemed to be quite useful- multiple projects using different versions of Newtonsoft could be quickly regularised to all use the same version. Most projects use the same version, some were ahead by a few minors, some lagged by at most one major version. Click click done, all projects now have the same version installed and referenced. Apparently.
Warnings appear about finding different conflicting versions of the same assembly, so I decided to file-find every Newtonsoft.Json.dll under the project tree and erase them, and also erase the solutiondirpackagesNewtonsoft.Json folder, then do a package restore and a rebuild the solution..
Bizarrely, it doesn’t seem to have helped.. I genuinely thought that clearing the old versions and having had NPM make every project in the solution on the same version, would mean there weren’t 9 different versions of it kicking around, but sure enough doing a search for the dll turns up different sized files all over the solution tree
What’s the right way to handle this and kill off the warnings about conflicting assemblies post consolidate?
c# visual-studio-2017 nuget-package nuget-package-restore conflicting-libraries
add a comment |
I’ve a solution with somewhere in the region of 60 projects, most of which use Newtonsoft.Json.dll and many of which reference each other. Things were building nicely, no warnings.
Took a look at the Consolidate feature of the nugget package manager, and it seemed to be quite useful- multiple projects using different versions of Newtonsoft could be quickly regularised to all use the same version. Most projects use the same version, some were ahead by a few minors, some lagged by at most one major version. Click click done, all projects now have the same version installed and referenced. Apparently.
Warnings appear about finding different conflicting versions of the same assembly, so I decided to file-find every Newtonsoft.Json.dll under the project tree and erase them, and also erase the solutiondirpackagesNewtonsoft.Json folder, then do a package restore and a rebuild the solution..
Bizarrely, it doesn’t seem to have helped.. I genuinely thought that clearing the old versions and having had NPM make every project in the solution on the same version, would mean there weren’t 9 different versions of it kicking around, but sure enough doing a search for the dll turns up different sized files all over the solution tree
What’s the right way to handle this and kill off the warnings about conflicting assemblies post consolidate?
c# visual-studio-2017 nuget-package nuget-package-restore conflicting-libraries
If any of your project dependencies also have a dependency on Newtonsoft, they'll pull in their own versions. Consolidate only affects your projects, not their dependencies. I assume that's what is happening.
– Amy
Nov 20 '18 at 20:35
Maybe your projects depend on nuget packages which depend on older versions of Newtonsoft.Json?
– Andrzej Gis
Nov 20 '18 at 21:01
It’s slightly confusing to me how there are now more warnings than there were before, about conflicting versions.. could it really be the case that the previous mishmash was so accurately balanced in terms of my projects that depend on other projects that depend on Newtonsoft, that both my projects and the other projects all depended on the same (different) versions?
– Caius Jard
Nov 20 '18 at 21:24
And does it mean that there is ultimately no solution other than whacking binding redirects in all over the place?
– Caius Jard
Nov 20 '18 at 21:28
If you have a direct dependency onA-1.2.3
, and one of your dependencies has a dependency onA-1.2.0
, you will need to use binding redirects, because consolidate will do nothing here. You only need assembly redirects in executable (or website) configuration files. Libraries don't need them, so "all over the place", no.
– Amy
Nov 20 '18 at 22:02
add a comment |
I’ve a solution with somewhere in the region of 60 projects, most of which use Newtonsoft.Json.dll and many of which reference each other. Things were building nicely, no warnings.
Took a look at the Consolidate feature of the nugget package manager, and it seemed to be quite useful- multiple projects using different versions of Newtonsoft could be quickly regularised to all use the same version. Most projects use the same version, some were ahead by a few minors, some lagged by at most one major version. Click click done, all projects now have the same version installed and referenced. Apparently.
Warnings appear about finding different conflicting versions of the same assembly, so I decided to file-find every Newtonsoft.Json.dll under the project tree and erase them, and also erase the solutiondirpackagesNewtonsoft.Json folder, then do a package restore and a rebuild the solution..
Bizarrely, it doesn’t seem to have helped.. I genuinely thought that clearing the old versions and having had NPM make every project in the solution on the same version, would mean there weren’t 9 different versions of it kicking around, but sure enough doing a search for the dll turns up different sized files all over the solution tree
What’s the right way to handle this and kill off the warnings about conflicting assemblies post consolidate?
c# visual-studio-2017 nuget-package nuget-package-restore conflicting-libraries
I’ve a solution with somewhere in the region of 60 projects, most of which use Newtonsoft.Json.dll and many of which reference each other. Things were building nicely, no warnings.
Took a look at the Consolidate feature of the nugget package manager, and it seemed to be quite useful- multiple projects using different versions of Newtonsoft could be quickly regularised to all use the same version. Most projects use the same version, some were ahead by a few minors, some lagged by at most one major version. Click click done, all projects now have the same version installed and referenced. Apparently.
Warnings appear about finding different conflicting versions of the same assembly, so I decided to file-find every Newtonsoft.Json.dll under the project tree and erase them, and also erase the solutiondirpackagesNewtonsoft.Json folder, then do a package restore and a rebuild the solution..
Bizarrely, it doesn’t seem to have helped.. I genuinely thought that clearing the old versions and having had NPM make every project in the solution on the same version, would mean there weren’t 9 different versions of it kicking around, but sure enough doing a search for the dll turns up different sized files all over the solution tree
What’s the right way to handle this and kill off the warnings about conflicting assemblies post consolidate?
c# visual-studio-2017 nuget-package nuget-package-restore conflicting-libraries
c# visual-studio-2017 nuget-package nuget-package-restore conflicting-libraries
asked Nov 20 '18 at 20:29


Caius JardCaius Jard
11.4k21239
11.4k21239
If any of your project dependencies also have a dependency on Newtonsoft, they'll pull in their own versions. Consolidate only affects your projects, not their dependencies. I assume that's what is happening.
– Amy
Nov 20 '18 at 20:35
Maybe your projects depend on nuget packages which depend on older versions of Newtonsoft.Json?
– Andrzej Gis
Nov 20 '18 at 21:01
It’s slightly confusing to me how there are now more warnings than there were before, about conflicting versions.. could it really be the case that the previous mishmash was so accurately balanced in terms of my projects that depend on other projects that depend on Newtonsoft, that both my projects and the other projects all depended on the same (different) versions?
– Caius Jard
Nov 20 '18 at 21:24
And does it mean that there is ultimately no solution other than whacking binding redirects in all over the place?
– Caius Jard
Nov 20 '18 at 21:28
If you have a direct dependency onA-1.2.3
, and one of your dependencies has a dependency onA-1.2.0
, you will need to use binding redirects, because consolidate will do nothing here. You only need assembly redirects in executable (or website) configuration files. Libraries don't need them, so "all over the place", no.
– Amy
Nov 20 '18 at 22:02
add a comment |
If any of your project dependencies also have a dependency on Newtonsoft, they'll pull in their own versions. Consolidate only affects your projects, not their dependencies. I assume that's what is happening.
– Amy
Nov 20 '18 at 20:35
Maybe your projects depend on nuget packages which depend on older versions of Newtonsoft.Json?
– Andrzej Gis
Nov 20 '18 at 21:01
It’s slightly confusing to me how there are now more warnings than there were before, about conflicting versions.. could it really be the case that the previous mishmash was so accurately balanced in terms of my projects that depend on other projects that depend on Newtonsoft, that both my projects and the other projects all depended on the same (different) versions?
– Caius Jard
Nov 20 '18 at 21:24
And does it mean that there is ultimately no solution other than whacking binding redirects in all over the place?
– Caius Jard
Nov 20 '18 at 21:28
If you have a direct dependency onA-1.2.3
, and one of your dependencies has a dependency onA-1.2.0
, you will need to use binding redirects, because consolidate will do nothing here. You only need assembly redirects in executable (or website) configuration files. Libraries don't need them, so "all over the place", no.
– Amy
Nov 20 '18 at 22:02
If any of your project dependencies also have a dependency on Newtonsoft, they'll pull in their own versions. Consolidate only affects your projects, not their dependencies. I assume that's what is happening.
– Amy
Nov 20 '18 at 20:35
If any of your project dependencies also have a dependency on Newtonsoft, they'll pull in their own versions. Consolidate only affects your projects, not their dependencies. I assume that's what is happening.
– Amy
Nov 20 '18 at 20:35
Maybe your projects depend on nuget packages which depend on older versions of Newtonsoft.Json?
– Andrzej Gis
Nov 20 '18 at 21:01
Maybe your projects depend on nuget packages which depend on older versions of Newtonsoft.Json?
– Andrzej Gis
Nov 20 '18 at 21:01
It’s slightly confusing to me how there are now more warnings than there were before, about conflicting versions.. could it really be the case that the previous mishmash was so accurately balanced in terms of my projects that depend on other projects that depend on Newtonsoft, that both my projects and the other projects all depended on the same (different) versions?
– Caius Jard
Nov 20 '18 at 21:24
It’s slightly confusing to me how there are now more warnings than there were before, about conflicting versions.. could it really be the case that the previous mishmash was so accurately balanced in terms of my projects that depend on other projects that depend on Newtonsoft, that both my projects and the other projects all depended on the same (different) versions?
– Caius Jard
Nov 20 '18 at 21:24
And does it mean that there is ultimately no solution other than whacking binding redirects in all over the place?
– Caius Jard
Nov 20 '18 at 21:28
And does it mean that there is ultimately no solution other than whacking binding redirects in all over the place?
– Caius Jard
Nov 20 '18 at 21:28
If you have a direct dependency on
A-1.2.3
, and one of your dependencies has a dependency on A-1.2.0
, you will need to use binding redirects, because consolidate will do nothing here. You only need assembly redirects in executable (or website) configuration files. Libraries don't need them, so "all over the place", no.– Amy
Nov 20 '18 at 22:02
If you have a direct dependency on
A-1.2.3
, and one of your dependencies has a dependency on A-1.2.0
, you will need to use binding redirects, because consolidate will do nothing here. You only need assembly redirects in executable (or website) configuration files. Libraries don't need them, so "all over the place", no.– Amy
Nov 20 '18 at 22:02
add a comment |
1 Answer
1
active
oldest
votes
I was able to resolve the warnings for my context, after realising that many of the projects in the solution had a web config binding redirect that called for 0.0.0.0-6.0.0.0 of Newtonsoft.Json to be redirected to 6.0.0.0
The installed version (5.0.2) had an assembly version of 4.5.0.0, the first one that I could find that had an assemblyversion of 6.0.0.0
Rather than adjust the binding redirects, I used the NPM to upgrade all the Newtonsoft.Json to v6.0.1 and subsequently all the projects references to it became dependent on an assemblyversion for it of 6.0.0.0
I presume thus that when a binding redirect specifies a version of a library that doesn't exist in the solution, and it is successfully fund elsewhere, that other version may become a conflicting version with the locally referenced one.
Edit: It appears that NuGet Package Manager (Console)/Powershell can also regularise the binding redirects, with the following command:
Get-Project –All | Add-BindingRedirect
More info: https://weblog.west-wind.com/posts/2014/Nov/29/Updating-Assembly-Redirects-with-NuGet
TLDR; ensure your binding redirects reference the version of a lib that is available in the project
NPM? Don't you mean Nuget? NPM is for NodeJS.
– Amy
Nov 22 '18 at 5:53
In this context, NPM was Nuget Package Manager, but I've edited it for clarity
– Caius Jard
Nov 22 '18 at 10:29
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53401037%2fvs2017-consolidating-newtonsoft-json-dll-but-it-could-just-as-easily-be-any-v%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I was able to resolve the warnings for my context, after realising that many of the projects in the solution had a web config binding redirect that called for 0.0.0.0-6.0.0.0 of Newtonsoft.Json to be redirected to 6.0.0.0
The installed version (5.0.2) had an assembly version of 4.5.0.0, the first one that I could find that had an assemblyversion of 6.0.0.0
Rather than adjust the binding redirects, I used the NPM to upgrade all the Newtonsoft.Json to v6.0.1 and subsequently all the projects references to it became dependent on an assemblyversion for it of 6.0.0.0
I presume thus that when a binding redirect specifies a version of a library that doesn't exist in the solution, and it is successfully fund elsewhere, that other version may become a conflicting version with the locally referenced one.
Edit: It appears that NuGet Package Manager (Console)/Powershell can also regularise the binding redirects, with the following command:
Get-Project –All | Add-BindingRedirect
More info: https://weblog.west-wind.com/posts/2014/Nov/29/Updating-Assembly-Redirects-with-NuGet
TLDR; ensure your binding redirects reference the version of a lib that is available in the project
NPM? Don't you mean Nuget? NPM is for NodeJS.
– Amy
Nov 22 '18 at 5:53
In this context, NPM was Nuget Package Manager, but I've edited it for clarity
– Caius Jard
Nov 22 '18 at 10:29
add a comment |
I was able to resolve the warnings for my context, after realising that many of the projects in the solution had a web config binding redirect that called for 0.0.0.0-6.0.0.0 of Newtonsoft.Json to be redirected to 6.0.0.0
The installed version (5.0.2) had an assembly version of 4.5.0.0, the first one that I could find that had an assemblyversion of 6.0.0.0
Rather than adjust the binding redirects, I used the NPM to upgrade all the Newtonsoft.Json to v6.0.1 and subsequently all the projects references to it became dependent on an assemblyversion for it of 6.0.0.0
I presume thus that when a binding redirect specifies a version of a library that doesn't exist in the solution, and it is successfully fund elsewhere, that other version may become a conflicting version with the locally referenced one.
Edit: It appears that NuGet Package Manager (Console)/Powershell can also regularise the binding redirects, with the following command:
Get-Project –All | Add-BindingRedirect
More info: https://weblog.west-wind.com/posts/2014/Nov/29/Updating-Assembly-Redirects-with-NuGet
TLDR; ensure your binding redirects reference the version of a lib that is available in the project
NPM? Don't you mean Nuget? NPM is for NodeJS.
– Amy
Nov 22 '18 at 5:53
In this context, NPM was Nuget Package Manager, but I've edited it for clarity
– Caius Jard
Nov 22 '18 at 10:29
add a comment |
I was able to resolve the warnings for my context, after realising that many of the projects in the solution had a web config binding redirect that called for 0.0.0.0-6.0.0.0 of Newtonsoft.Json to be redirected to 6.0.0.0
The installed version (5.0.2) had an assembly version of 4.5.0.0, the first one that I could find that had an assemblyversion of 6.0.0.0
Rather than adjust the binding redirects, I used the NPM to upgrade all the Newtonsoft.Json to v6.0.1 and subsequently all the projects references to it became dependent on an assemblyversion for it of 6.0.0.0
I presume thus that when a binding redirect specifies a version of a library that doesn't exist in the solution, and it is successfully fund elsewhere, that other version may become a conflicting version with the locally referenced one.
Edit: It appears that NuGet Package Manager (Console)/Powershell can also regularise the binding redirects, with the following command:
Get-Project –All | Add-BindingRedirect
More info: https://weblog.west-wind.com/posts/2014/Nov/29/Updating-Assembly-Redirects-with-NuGet
TLDR; ensure your binding redirects reference the version of a lib that is available in the project
I was able to resolve the warnings for my context, after realising that many of the projects in the solution had a web config binding redirect that called for 0.0.0.0-6.0.0.0 of Newtonsoft.Json to be redirected to 6.0.0.0
The installed version (5.0.2) had an assembly version of 4.5.0.0, the first one that I could find that had an assemblyversion of 6.0.0.0
Rather than adjust the binding redirects, I used the NPM to upgrade all the Newtonsoft.Json to v6.0.1 and subsequently all the projects references to it became dependent on an assemblyversion for it of 6.0.0.0
I presume thus that when a binding redirect specifies a version of a library that doesn't exist in the solution, and it is successfully fund elsewhere, that other version may become a conflicting version with the locally referenced one.
Edit: It appears that NuGet Package Manager (Console)/Powershell can also regularise the binding redirects, with the following command:
Get-Project –All | Add-BindingRedirect
More info: https://weblog.west-wind.com/posts/2014/Nov/29/Updating-Assembly-Redirects-with-NuGet
TLDR; ensure your binding redirects reference the version of a lib that is available in the project
edited Nov 22 '18 at 10:28
answered Nov 21 '18 at 14:40


Caius JardCaius Jard
11.4k21239
11.4k21239
NPM? Don't you mean Nuget? NPM is for NodeJS.
– Amy
Nov 22 '18 at 5:53
In this context, NPM was Nuget Package Manager, but I've edited it for clarity
– Caius Jard
Nov 22 '18 at 10:29
add a comment |
NPM? Don't you mean Nuget? NPM is for NodeJS.
– Amy
Nov 22 '18 at 5:53
In this context, NPM was Nuget Package Manager, but I've edited it for clarity
– Caius Jard
Nov 22 '18 at 10:29
NPM? Don't you mean Nuget? NPM is for NodeJS.
– Amy
Nov 22 '18 at 5:53
NPM? Don't you mean Nuget? NPM is for NodeJS.
– Amy
Nov 22 '18 at 5:53
In this context, NPM was Nuget Package Manager, but I've edited it for clarity
– Caius Jard
Nov 22 '18 at 10:29
In this context, NPM was Nuget Package Manager, but I've edited it for clarity
– Caius Jard
Nov 22 '18 at 10:29
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53401037%2fvs2017-consolidating-newtonsoft-json-dll-but-it-could-just-as-easily-be-any-v%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
If any of your project dependencies also have a dependency on Newtonsoft, they'll pull in their own versions. Consolidate only affects your projects, not their dependencies. I assume that's what is happening.
– Amy
Nov 20 '18 at 20:35
Maybe your projects depend on nuget packages which depend on older versions of Newtonsoft.Json?
– Andrzej Gis
Nov 20 '18 at 21:01
It’s slightly confusing to me how there are now more warnings than there were before, about conflicting versions.. could it really be the case that the previous mishmash was so accurately balanced in terms of my projects that depend on other projects that depend on Newtonsoft, that both my projects and the other projects all depended on the same (different) versions?
– Caius Jard
Nov 20 '18 at 21:24
And does it mean that there is ultimately no solution other than whacking binding redirects in all over the place?
– Caius Jard
Nov 20 '18 at 21:28
If you have a direct dependency on
A-1.2.3
, and one of your dependencies has a dependency onA-1.2.0
, you will need to use binding redirects, because consolidate will do nothing here. You only need assembly redirects in executable (or website) configuration files. Libraries don't need them, so "all over the place", no.– Amy
Nov 20 '18 at 22:02