Using NuGet on multiple solutions project with the same output path












0















I've tried to look at many of the questions asked here about it, but none is exactly like my set-up.



Also, this issue is NOT directly related to Nuget, but it might be part of the solution.



I have a project which consists of a few solutions. All of the projects in those solutions use the same output path.



Example:



-Root
--Solution1
--Solution2
--Solution3
--OutputForAllProjectsInAllSolutions


I want to use NuGets in those solutions. The problem is if I'll use different version of the same NuGet package in each solution, then the each solution will override it's predecessor's reference dlls.



I was thinking of a solution, but I don't know if it's possible and how.



Something like:



-Root
--Solution1
--Solution2
--Solution3
--PackagesFolderForAllSolutions // can be done with repositoryPath right?
--OutputForAllProjectsInAllSolutions
---NugetPackageVersion1
---NugetPackageVersion2
---NugetPackageVersion3


Is it a possible? Is it a good solution? How to do it?
If not, any better suggestions?



Thanks in advance.





  • EDIT: I wish I could use 1 solution for all, but it's legacy code, and it has too much complexity.


The setup is 1 source-code repository with multiple solutions.










share|improve this question

























  • What is the reason to organize your solutions like this? Why not just keep them independent of each other!

    – DaveInCaz
    Nov 18 '18 at 11:25











  • Legacy code.. :(

    – Idan Levi
    Nov 18 '18 at 13:56
















0















I've tried to look at many of the questions asked here about it, but none is exactly like my set-up.



Also, this issue is NOT directly related to Nuget, but it might be part of the solution.



I have a project which consists of a few solutions. All of the projects in those solutions use the same output path.



Example:



-Root
--Solution1
--Solution2
--Solution3
--OutputForAllProjectsInAllSolutions


I want to use NuGets in those solutions. The problem is if I'll use different version of the same NuGet package in each solution, then the each solution will override it's predecessor's reference dlls.



I was thinking of a solution, but I don't know if it's possible and how.



Something like:



-Root
--Solution1
--Solution2
--Solution3
--PackagesFolderForAllSolutions // can be done with repositoryPath right?
--OutputForAllProjectsInAllSolutions
---NugetPackageVersion1
---NugetPackageVersion2
---NugetPackageVersion3


Is it a possible? Is it a good solution? How to do it?
If not, any better suggestions?



Thanks in advance.





  • EDIT: I wish I could use 1 solution for all, but it's legacy code, and it has too much complexity.


The setup is 1 source-code repository with multiple solutions.










share|improve this question

























  • What is the reason to organize your solutions like this? Why not just keep them independent of each other!

    – DaveInCaz
    Nov 18 '18 at 11:25











  • Legacy code.. :(

    – Idan Levi
    Nov 18 '18 at 13:56














0












0








0








I've tried to look at many of the questions asked here about it, but none is exactly like my set-up.



Also, this issue is NOT directly related to Nuget, but it might be part of the solution.



I have a project which consists of a few solutions. All of the projects in those solutions use the same output path.



Example:



-Root
--Solution1
--Solution2
--Solution3
--OutputForAllProjectsInAllSolutions


I want to use NuGets in those solutions. The problem is if I'll use different version of the same NuGet package in each solution, then the each solution will override it's predecessor's reference dlls.



I was thinking of a solution, but I don't know if it's possible and how.



Something like:



-Root
--Solution1
--Solution2
--Solution3
--PackagesFolderForAllSolutions // can be done with repositoryPath right?
--OutputForAllProjectsInAllSolutions
---NugetPackageVersion1
---NugetPackageVersion2
---NugetPackageVersion3


Is it a possible? Is it a good solution? How to do it?
If not, any better suggestions?



Thanks in advance.





  • EDIT: I wish I could use 1 solution for all, but it's legacy code, and it has too much complexity.


The setup is 1 source-code repository with multiple solutions.










share|improve this question
















I've tried to look at many of the questions asked here about it, but none is exactly like my set-up.



Also, this issue is NOT directly related to Nuget, but it might be part of the solution.



I have a project which consists of a few solutions. All of the projects in those solutions use the same output path.



Example:



-Root
--Solution1
--Solution2
--Solution3
--OutputForAllProjectsInAllSolutions


I want to use NuGets in those solutions. The problem is if I'll use different version of the same NuGet package in each solution, then the each solution will override it's predecessor's reference dlls.



I was thinking of a solution, but I don't know if it's possible and how.



Something like:



-Root
--Solution1
--Solution2
--Solution3
--PackagesFolderForAllSolutions // can be done with repositoryPath right?
--OutputForAllProjectsInAllSolutions
---NugetPackageVersion1
---NugetPackageVersion2
---NugetPackageVersion3


Is it a possible? Is it a good solution? How to do it?
If not, any better suggestions?



Thanks in advance.





  • EDIT: I wish I could use 1 solution for all, but it's legacy code, and it has too much complexity.


The setup is 1 source-code repository with multiple solutions.







c# reference nuget nuget-package project-structure






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 '18 at 9:49







Idan Levi

















asked Nov 18 '18 at 10:27









Idan LeviIdan Levi

1098




1098













  • What is the reason to organize your solutions like this? Why not just keep them independent of each other!

    – DaveInCaz
    Nov 18 '18 at 11:25











  • Legacy code.. :(

    – Idan Levi
    Nov 18 '18 at 13:56



















  • What is the reason to organize your solutions like this? Why not just keep them independent of each other!

    – DaveInCaz
    Nov 18 '18 at 11:25











  • Legacy code.. :(

    – Idan Levi
    Nov 18 '18 at 13:56

















What is the reason to organize your solutions like this? Why not just keep them independent of each other!

– DaveInCaz
Nov 18 '18 at 11:25





What is the reason to organize your solutions like this? Why not just keep them independent of each other!

– DaveInCaz
Nov 18 '18 at 11:25













Legacy code.. :(

– Idan Levi
Nov 18 '18 at 13:56





Legacy code.. :(

– Idan Levi
Nov 18 '18 at 13:56












1 Answer
1






active

oldest

votes


















1














The real question appears to be "how can I make sure all projects use the same version of a dependency", but it's unclear to me if you proposed using a shared packages folder in order to save disk space. Using a shared folder will not solve the multiple versions problem, you'll just end up with a packages folder with multiple versions of a package, but maybe you want to save disk space, so I'll answer that as a separate question. I'm going to avoid the opinionated 'is it a good solution', but in my opinion the "better solution" you asked for is to migrate all projects to PackageReference and use the solution I give below. Also considering using a single solution, but that's unrelated to nuget package versions.




How can I make sure all my projects are using the same version of a NuGet dependency





  • Code in multiple source control repositories


If your code is spread across multiple source code repositories, then if your cross-project references are internal nuget packages, the projects that depend on projects from other repos via a nuget package will get external nuget dependencies transitively, so simply avoid upgrading nuget packages in your downstream projects. Upgrading will mean upgrading in your upstream project, generate a new nuget with a higher dependency version, generating a package, then updating the version of your internal package in your downstream project. It's a lot of effort, which is why I dislike having applications/systems spread across multiple source code repositories. There may still be reasons to do it which outweigh the costs, and to me that's what engineering is all about, dealing with trade-offs.




  • Code in single repository. Multiple solutions, NuGet packages via packages.config


If your code is in a single repository, at least one of your projects use packages.config and your application is spread across multiple solutions, then there's still going to be a reasonable amount of manual work, but the fewer packages.config projects there are, the less work there will be. You could use the method for a single solution application, and do it multiple times for each solution.




  • One solution, NuGet packages via packages.config


Right click the solution, select "Manage NuGet Packages for Solution", then go to the Consolodate tab.




  • NuGet packages via PackageReference


If you're using PackageReference, it doesn't matter if your repo has a single solution or multiple solutions. You can create a MSBuild props file with your NuGet package versions. As an example, have a look at this ASP.NET Core example. If you put these properties in a file named Directory.Build.props at the repo root, newish versions of MSBuild should (I've never tested it myself) import it automatically. Otherwise you'll need to edit all your project files to include an import to the props file. Then you edit the project files and change the version to use the MSBuild property. Again, example from the ASP.NET Core repo. Downside is that you can no longer use Visual Studio to update the package versions, but you can still use it to check for new versions and see what the newest versions are.



If your application has multiple repos, and multiple projects are using PackageReference, you can look into putting the props file in a git submodule, or something equivalent for your source control system.



In conclusion



I strongly recommend migrating from packages.config to PackageReference, and then you can use a MSBuild props file to automatically keep all projects using the same version of each dependency.




Can I reduce disk space by using a single packages folder for multiple solutions




Firstly, if all your projects used PackageReference, this wouldn't be an issue because NuGet does not copy PackageReference packages into solution folders, so there's even less disk usage than using packages.config with a shared packages folder, because you're still going to have one copy in the global packages folder and another in the solution packages folder.



But if you can't/won't migrate to PackageReference, then yes, as you asked in your question, you can use a nuget.config file at the root level to set <repositoryPath>packages</repositoryPath> to make all the solutions use the same packages folder at the root level, as long as the solution folders don't have their own nuget.config file that overrides the setting. You can change packages to anything you want, but I discourage using ..anything because I hate it when projects write files outside of their repository root.






share|improve this answer
























  • Thanks a lot for the detailed answer.The main part of the suggestion I made wasn't the global 'packages' folder (I don't care about disk space), but the different versions of the same dll in the output folder. Lets say I have two executables in the output folder - 1.exe and 2.exe, and they use different versions of the same dll (nuget) - a.dll. Is it possible to have both versions of a.dll in output folder (each in a separate nested folder) and have 1.exe & 2.exe use the one each of them needs?

    – Idan Levi
    Nov 19 '18 at 9:46











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%2f53359866%2fusing-nuget-on-multiple-solutions-project-with-the-same-output-path%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









1














The real question appears to be "how can I make sure all projects use the same version of a dependency", but it's unclear to me if you proposed using a shared packages folder in order to save disk space. Using a shared folder will not solve the multiple versions problem, you'll just end up with a packages folder with multiple versions of a package, but maybe you want to save disk space, so I'll answer that as a separate question. I'm going to avoid the opinionated 'is it a good solution', but in my opinion the "better solution" you asked for is to migrate all projects to PackageReference and use the solution I give below. Also considering using a single solution, but that's unrelated to nuget package versions.




How can I make sure all my projects are using the same version of a NuGet dependency





  • Code in multiple source control repositories


If your code is spread across multiple source code repositories, then if your cross-project references are internal nuget packages, the projects that depend on projects from other repos via a nuget package will get external nuget dependencies transitively, so simply avoid upgrading nuget packages in your downstream projects. Upgrading will mean upgrading in your upstream project, generate a new nuget with a higher dependency version, generating a package, then updating the version of your internal package in your downstream project. It's a lot of effort, which is why I dislike having applications/systems spread across multiple source code repositories. There may still be reasons to do it which outweigh the costs, and to me that's what engineering is all about, dealing with trade-offs.




  • Code in single repository. Multiple solutions, NuGet packages via packages.config


If your code is in a single repository, at least one of your projects use packages.config and your application is spread across multiple solutions, then there's still going to be a reasonable amount of manual work, but the fewer packages.config projects there are, the less work there will be. You could use the method for a single solution application, and do it multiple times for each solution.




  • One solution, NuGet packages via packages.config


Right click the solution, select "Manage NuGet Packages for Solution", then go to the Consolodate tab.




  • NuGet packages via PackageReference


If you're using PackageReference, it doesn't matter if your repo has a single solution or multiple solutions. You can create a MSBuild props file with your NuGet package versions. As an example, have a look at this ASP.NET Core example. If you put these properties in a file named Directory.Build.props at the repo root, newish versions of MSBuild should (I've never tested it myself) import it automatically. Otherwise you'll need to edit all your project files to include an import to the props file. Then you edit the project files and change the version to use the MSBuild property. Again, example from the ASP.NET Core repo. Downside is that you can no longer use Visual Studio to update the package versions, but you can still use it to check for new versions and see what the newest versions are.



If your application has multiple repos, and multiple projects are using PackageReference, you can look into putting the props file in a git submodule, or something equivalent for your source control system.



In conclusion



I strongly recommend migrating from packages.config to PackageReference, and then you can use a MSBuild props file to automatically keep all projects using the same version of each dependency.




Can I reduce disk space by using a single packages folder for multiple solutions




Firstly, if all your projects used PackageReference, this wouldn't be an issue because NuGet does not copy PackageReference packages into solution folders, so there's even less disk usage than using packages.config with a shared packages folder, because you're still going to have one copy in the global packages folder and another in the solution packages folder.



But if you can't/won't migrate to PackageReference, then yes, as you asked in your question, you can use a nuget.config file at the root level to set <repositoryPath>packages</repositoryPath> to make all the solutions use the same packages folder at the root level, as long as the solution folders don't have their own nuget.config file that overrides the setting. You can change packages to anything you want, but I discourage using ..anything because I hate it when projects write files outside of their repository root.






share|improve this answer
























  • Thanks a lot for the detailed answer.The main part of the suggestion I made wasn't the global 'packages' folder (I don't care about disk space), but the different versions of the same dll in the output folder. Lets say I have two executables in the output folder - 1.exe and 2.exe, and they use different versions of the same dll (nuget) - a.dll. Is it possible to have both versions of a.dll in output folder (each in a separate nested folder) and have 1.exe & 2.exe use the one each of them needs?

    – Idan Levi
    Nov 19 '18 at 9:46
















1














The real question appears to be "how can I make sure all projects use the same version of a dependency", but it's unclear to me if you proposed using a shared packages folder in order to save disk space. Using a shared folder will not solve the multiple versions problem, you'll just end up with a packages folder with multiple versions of a package, but maybe you want to save disk space, so I'll answer that as a separate question. I'm going to avoid the opinionated 'is it a good solution', but in my opinion the "better solution" you asked for is to migrate all projects to PackageReference and use the solution I give below. Also considering using a single solution, but that's unrelated to nuget package versions.




How can I make sure all my projects are using the same version of a NuGet dependency





  • Code in multiple source control repositories


If your code is spread across multiple source code repositories, then if your cross-project references are internal nuget packages, the projects that depend on projects from other repos via a nuget package will get external nuget dependencies transitively, so simply avoid upgrading nuget packages in your downstream projects. Upgrading will mean upgrading in your upstream project, generate a new nuget with a higher dependency version, generating a package, then updating the version of your internal package in your downstream project. It's a lot of effort, which is why I dislike having applications/systems spread across multiple source code repositories. There may still be reasons to do it which outweigh the costs, and to me that's what engineering is all about, dealing with trade-offs.




  • Code in single repository. Multiple solutions, NuGet packages via packages.config


If your code is in a single repository, at least one of your projects use packages.config and your application is spread across multiple solutions, then there's still going to be a reasonable amount of manual work, but the fewer packages.config projects there are, the less work there will be. You could use the method for a single solution application, and do it multiple times for each solution.




  • One solution, NuGet packages via packages.config


Right click the solution, select "Manage NuGet Packages for Solution", then go to the Consolodate tab.




  • NuGet packages via PackageReference


If you're using PackageReference, it doesn't matter if your repo has a single solution or multiple solutions. You can create a MSBuild props file with your NuGet package versions. As an example, have a look at this ASP.NET Core example. If you put these properties in a file named Directory.Build.props at the repo root, newish versions of MSBuild should (I've never tested it myself) import it automatically. Otherwise you'll need to edit all your project files to include an import to the props file. Then you edit the project files and change the version to use the MSBuild property. Again, example from the ASP.NET Core repo. Downside is that you can no longer use Visual Studio to update the package versions, but you can still use it to check for new versions and see what the newest versions are.



If your application has multiple repos, and multiple projects are using PackageReference, you can look into putting the props file in a git submodule, or something equivalent for your source control system.



In conclusion



I strongly recommend migrating from packages.config to PackageReference, and then you can use a MSBuild props file to automatically keep all projects using the same version of each dependency.




Can I reduce disk space by using a single packages folder for multiple solutions




Firstly, if all your projects used PackageReference, this wouldn't be an issue because NuGet does not copy PackageReference packages into solution folders, so there's even less disk usage than using packages.config with a shared packages folder, because you're still going to have one copy in the global packages folder and another in the solution packages folder.



But if you can't/won't migrate to PackageReference, then yes, as you asked in your question, you can use a nuget.config file at the root level to set <repositoryPath>packages</repositoryPath> to make all the solutions use the same packages folder at the root level, as long as the solution folders don't have their own nuget.config file that overrides the setting. You can change packages to anything you want, but I discourage using ..anything because I hate it when projects write files outside of their repository root.






share|improve this answer
























  • Thanks a lot for the detailed answer.The main part of the suggestion I made wasn't the global 'packages' folder (I don't care about disk space), but the different versions of the same dll in the output folder. Lets say I have two executables in the output folder - 1.exe and 2.exe, and they use different versions of the same dll (nuget) - a.dll. Is it possible to have both versions of a.dll in output folder (each in a separate nested folder) and have 1.exe & 2.exe use the one each of them needs?

    – Idan Levi
    Nov 19 '18 at 9:46














1












1








1







The real question appears to be "how can I make sure all projects use the same version of a dependency", but it's unclear to me if you proposed using a shared packages folder in order to save disk space. Using a shared folder will not solve the multiple versions problem, you'll just end up with a packages folder with multiple versions of a package, but maybe you want to save disk space, so I'll answer that as a separate question. I'm going to avoid the opinionated 'is it a good solution', but in my opinion the "better solution" you asked for is to migrate all projects to PackageReference and use the solution I give below. Also considering using a single solution, but that's unrelated to nuget package versions.




How can I make sure all my projects are using the same version of a NuGet dependency





  • Code in multiple source control repositories


If your code is spread across multiple source code repositories, then if your cross-project references are internal nuget packages, the projects that depend on projects from other repos via a nuget package will get external nuget dependencies transitively, so simply avoid upgrading nuget packages in your downstream projects. Upgrading will mean upgrading in your upstream project, generate a new nuget with a higher dependency version, generating a package, then updating the version of your internal package in your downstream project. It's a lot of effort, which is why I dislike having applications/systems spread across multiple source code repositories. There may still be reasons to do it which outweigh the costs, and to me that's what engineering is all about, dealing with trade-offs.




  • Code in single repository. Multiple solutions, NuGet packages via packages.config


If your code is in a single repository, at least one of your projects use packages.config and your application is spread across multiple solutions, then there's still going to be a reasonable amount of manual work, but the fewer packages.config projects there are, the less work there will be. You could use the method for a single solution application, and do it multiple times for each solution.




  • One solution, NuGet packages via packages.config


Right click the solution, select "Manage NuGet Packages for Solution", then go to the Consolodate tab.




  • NuGet packages via PackageReference


If you're using PackageReference, it doesn't matter if your repo has a single solution or multiple solutions. You can create a MSBuild props file with your NuGet package versions. As an example, have a look at this ASP.NET Core example. If you put these properties in a file named Directory.Build.props at the repo root, newish versions of MSBuild should (I've never tested it myself) import it automatically. Otherwise you'll need to edit all your project files to include an import to the props file. Then you edit the project files and change the version to use the MSBuild property. Again, example from the ASP.NET Core repo. Downside is that you can no longer use Visual Studio to update the package versions, but you can still use it to check for new versions and see what the newest versions are.



If your application has multiple repos, and multiple projects are using PackageReference, you can look into putting the props file in a git submodule, or something equivalent for your source control system.



In conclusion



I strongly recommend migrating from packages.config to PackageReference, and then you can use a MSBuild props file to automatically keep all projects using the same version of each dependency.




Can I reduce disk space by using a single packages folder for multiple solutions




Firstly, if all your projects used PackageReference, this wouldn't be an issue because NuGet does not copy PackageReference packages into solution folders, so there's even less disk usage than using packages.config with a shared packages folder, because you're still going to have one copy in the global packages folder and another in the solution packages folder.



But if you can't/won't migrate to PackageReference, then yes, as you asked in your question, you can use a nuget.config file at the root level to set <repositoryPath>packages</repositoryPath> to make all the solutions use the same packages folder at the root level, as long as the solution folders don't have their own nuget.config file that overrides the setting. You can change packages to anything you want, but I discourage using ..anything because I hate it when projects write files outside of their repository root.






share|improve this answer













The real question appears to be "how can I make sure all projects use the same version of a dependency", but it's unclear to me if you proposed using a shared packages folder in order to save disk space. Using a shared folder will not solve the multiple versions problem, you'll just end up with a packages folder with multiple versions of a package, but maybe you want to save disk space, so I'll answer that as a separate question. I'm going to avoid the opinionated 'is it a good solution', but in my opinion the "better solution" you asked for is to migrate all projects to PackageReference and use the solution I give below. Also considering using a single solution, but that's unrelated to nuget package versions.




How can I make sure all my projects are using the same version of a NuGet dependency





  • Code in multiple source control repositories


If your code is spread across multiple source code repositories, then if your cross-project references are internal nuget packages, the projects that depend on projects from other repos via a nuget package will get external nuget dependencies transitively, so simply avoid upgrading nuget packages in your downstream projects. Upgrading will mean upgrading in your upstream project, generate a new nuget with a higher dependency version, generating a package, then updating the version of your internal package in your downstream project. It's a lot of effort, which is why I dislike having applications/systems spread across multiple source code repositories. There may still be reasons to do it which outweigh the costs, and to me that's what engineering is all about, dealing with trade-offs.




  • Code in single repository. Multiple solutions, NuGet packages via packages.config


If your code is in a single repository, at least one of your projects use packages.config and your application is spread across multiple solutions, then there's still going to be a reasonable amount of manual work, but the fewer packages.config projects there are, the less work there will be. You could use the method for a single solution application, and do it multiple times for each solution.




  • One solution, NuGet packages via packages.config


Right click the solution, select "Manage NuGet Packages for Solution", then go to the Consolodate tab.




  • NuGet packages via PackageReference


If you're using PackageReference, it doesn't matter if your repo has a single solution or multiple solutions. You can create a MSBuild props file with your NuGet package versions. As an example, have a look at this ASP.NET Core example. If you put these properties in a file named Directory.Build.props at the repo root, newish versions of MSBuild should (I've never tested it myself) import it automatically. Otherwise you'll need to edit all your project files to include an import to the props file. Then you edit the project files and change the version to use the MSBuild property. Again, example from the ASP.NET Core repo. Downside is that you can no longer use Visual Studio to update the package versions, but you can still use it to check for new versions and see what the newest versions are.



If your application has multiple repos, and multiple projects are using PackageReference, you can look into putting the props file in a git submodule, or something equivalent for your source control system.



In conclusion



I strongly recommend migrating from packages.config to PackageReference, and then you can use a MSBuild props file to automatically keep all projects using the same version of each dependency.




Can I reduce disk space by using a single packages folder for multiple solutions




Firstly, if all your projects used PackageReference, this wouldn't be an issue because NuGet does not copy PackageReference packages into solution folders, so there's even less disk usage than using packages.config with a shared packages folder, because you're still going to have one copy in the global packages folder and another in the solution packages folder.



But if you can't/won't migrate to PackageReference, then yes, as you asked in your question, you can use a nuget.config file at the root level to set <repositoryPath>packages</repositoryPath> to make all the solutions use the same packages folder at the root level, as long as the solution folders don't have their own nuget.config file that overrides the setting. You can change packages to anything you want, but I discourage using ..anything because I hate it when projects write files outside of their repository root.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 18 '18 at 15:12









zivkanzivkan

1,364917




1,364917













  • Thanks a lot for the detailed answer.The main part of the suggestion I made wasn't the global 'packages' folder (I don't care about disk space), but the different versions of the same dll in the output folder. Lets say I have two executables in the output folder - 1.exe and 2.exe, and they use different versions of the same dll (nuget) - a.dll. Is it possible to have both versions of a.dll in output folder (each in a separate nested folder) and have 1.exe & 2.exe use the one each of them needs?

    – Idan Levi
    Nov 19 '18 at 9:46



















  • Thanks a lot for the detailed answer.The main part of the suggestion I made wasn't the global 'packages' folder (I don't care about disk space), but the different versions of the same dll in the output folder. Lets say I have two executables in the output folder - 1.exe and 2.exe, and they use different versions of the same dll (nuget) - a.dll. Is it possible to have both versions of a.dll in output folder (each in a separate nested folder) and have 1.exe & 2.exe use the one each of them needs?

    – Idan Levi
    Nov 19 '18 at 9:46

















Thanks a lot for the detailed answer.The main part of the suggestion I made wasn't the global 'packages' folder (I don't care about disk space), but the different versions of the same dll in the output folder. Lets say I have two executables in the output folder - 1.exe and 2.exe, and they use different versions of the same dll (nuget) - a.dll. Is it possible to have both versions of a.dll in output folder (each in a separate nested folder) and have 1.exe & 2.exe use the one each of them needs?

– Idan Levi
Nov 19 '18 at 9:46





Thanks a lot for the detailed answer.The main part of the suggestion I made wasn't the global 'packages' folder (I don't care about disk space), but the different versions of the same dll in the output folder. Lets say I have two executables in the output folder - 1.exe and 2.exe, and they use different versions of the same dll (nuget) - a.dll. Is it possible to have both versions of a.dll in output folder (each in a separate nested folder) and have 1.exe & 2.exe use the one each of them needs?

– Idan Levi
Nov 19 '18 at 9:46


















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%2f53359866%2fusing-nuget-on-multiple-solutions-project-with-the-same-output-path%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







這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini