Get a list of all NuGet packages used in a solution
I'm looking for a way to get a list of all used NuGet packages in every project in a solution (and specifically the version) using command-line script and not manually in Visual Studio.
Using the Package Manager Console with the command "Get-Package" gives me what I want, but it is unavailable outside of VS.
I'm using is a local NuGet feed.
My default package management format is PackageReference.
Any idea would be helpful
c# nuget
add a comment |
I'm looking for a way to get a list of all used NuGet packages in every project in a solution (and specifically the version) using command-line script and not manually in Visual Studio.
Using the Package Manager Console with the command "Get-Package" gives me what I want, but it is unavailable outside of VS.
I'm using is a local NuGet feed.
My default package management format is PackageReference.
Any idea would be helpful
c# nuget
1
Can't you just read them from the project files?
– stuartd
Nov 22 '18 at 17:32
they are explicitly listed in plain text packages.config for each project. There are usually hints as to the location of the package in the project files, but Nuget Package restore uses the packages.config.
– user5292841
Nov 22 '18 at 18:01
@JeffDavies Thank for your answer. I have a solution with more than 150 projects. so search it may not be the best solution for me, but that will do the work. thanks!
– Avihay
Nov 25 '18 at 8:10
@Avihay, this powershell command will list all packages.configs: Get-ChildItem -Path $path -Recurse -Filter "packages.config" | select fullname . I'm not sufficiently versed in powershell to cat the contents of files from this list. Could easily do it in Bash.
– user5292841
Nov 25 '18 at 14:22
add a comment |
I'm looking for a way to get a list of all used NuGet packages in every project in a solution (and specifically the version) using command-line script and not manually in Visual Studio.
Using the Package Manager Console with the command "Get-Package" gives me what I want, but it is unavailable outside of VS.
I'm using is a local NuGet feed.
My default package management format is PackageReference.
Any idea would be helpful
c# nuget
I'm looking for a way to get a list of all used NuGet packages in every project in a solution (and specifically the version) using command-line script and not manually in Visual Studio.
Using the Package Manager Console with the command "Get-Package" gives me what I want, but it is unavailable outside of VS.
I'm using is a local NuGet feed.
My default package management format is PackageReference.
Any idea would be helpful
c# nuget
c# nuget
edited Nov 28 '18 at 12:57
iosi G
532316
532316
asked Nov 22 '18 at 17:16
AvihayAvihay
1615
1615
1
Can't you just read them from the project files?
– stuartd
Nov 22 '18 at 17:32
they are explicitly listed in plain text packages.config for each project. There are usually hints as to the location of the package in the project files, but Nuget Package restore uses the packages.config.
– user5292841
Nov 22 '18 at 18:01
@JeffDavies Thank for your answer. I have a solution with more than 150 projects. so search it may not be the best solution for me, but that will do the work. thanks!
– Avihay
Nov 25 '18 at 8:10
@Avihay, this powershell command will list all packages.configs: Get-ChildItem -Path $path -Recurse -Filter "packages.config" | select fullname . I'm not sufficiently versed in powershell to cat the contents of files from this list. Could easily do it in Bash.
– user5292841
Nov 25 '18 at 14:22
add a comment |
1
Can't you just read them from the project files?
– stuartd
Nov 22 '18 at 17:32
they are explicitly listed in plain text packages.config for each project. There are usually hints as to the location of the package in the project files, but Nuget Package restore uses the packages.config.
– user5292841
Nov 22 '18 at 18:01
@JeffDavies Thank for your answer. I have a solution with more than 150 projects. so search it may not be the best solution for me, but that will do the work. thanks!
– Avihay
Nov 25 '18 at 8:10
@Avihay, this powershell command will list all packages.configs: Get-ChildItem -Path $path -Recurse -Filter "packages.config" | select fullname . I'm not sufficiently versed in powershell to cat the contents of files from this list. Could easily do it in Bash.
– user5292841
Nov 25 '18 at 14:22
1
1
Can't you just read them from the project files?
– stuartd
Nov 22 '18 at 17:32
Can't you just read them from the project files?
– stuartd
Nov 22 '18 at 17:32
they are explicitly listed in plain text packages.config for each project. There are usually hints as to the location of the package in the project files, but Nuget Package restore uses the packages.config.
– user5292841
Nov 22 '18 at 18:01
they are explicitly listed in plain text packages.config for each project. There are usually hints as to the location of the package in the project files, but Nuget Package restore uses the packages.config.
– user5292841
Nov 22 '18 at 18:01
@JeffDavies Thank for your answer. I have a solution with more than 150 projects. so search it may not be the best solution for me, but that will do the work. thanks!
– Avihay
Nov 25 '18 at 8:10
@JeffDavies Thank for your answer. I have a solution with more than 150 projects. so search it may not be the best solution for me, but that will do the work. thanks!
– Avihay
Nov 25 '18 at 8:10
@Avihay, this powershell command will list all packages.configs: Get-ChildItem -Path $path -Recurse -Filter "packages.config" | select fullname . I'm not sufficiently versed in powershell to cat the contents of files from this list. Could easily do it in Bash.
– user5292841
Nov 25 '18 at 14:22
@Avihay, this powershell command will list all packages.configs: Get-ChildItem -Path $path -Recurse -Filter "packages.config" | select fullname . I'm not sufficiently versed in powershell to cat the contents of files from this list. Could easily do it in Bash.
– user5292841
Nov 25 '18 at 14:22
add a comment |
3 Answers
3
active
oldest
votes
I'm sure there are better ways to do this, but here's a round-the-houses PowerShell way when using PackageReferences:
Get-Content .<solution>.sln | where { $_ -match "Project.+, ""(.+)""," } | foreach { $matches[1] } | % {Get-Content $_ | Find "<PackageReference Include" } | Sort-Object -Unique
Run it in the folder where the .sln lives.
It produces output like this:
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.5.0" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.4" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.5" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
I intentionally remove duplicates; you could omit that part if you prefer.
In my case, this matches the output from Get-Package
with the one exception being Microsoft.NETCore.App
, as that is not listed as a dependency anywhere, but is probably rather derived from <TargetFramework>netcoreapp2.1</TargetFramework>
.
Nice idea. but for some reason it does not show the version number. i.e<PackageReference Include="Newtonsoft.Json">
Is there something that i missing? @sellotape
– Avihay
Nov 25 '18 at 8:38
@Avihay - it's just showing the line in the .csproj there. Have a look inside your .csproj's and see whether there is something fundamentally different to those in my example.
– sellotape
Nov 25 '18 at 8:45
add a comment |
Writing a script that finds the occurrences of the tag PackageReference on each one of the csproj files is a great idea, as proposed by selotape.
This solution won't work if your csproj file has something like this:
<PackageReference Include"SomePackage">
<Version>1.0.42</Version>
</PackageReference>
Even though I recommend that you change the format to state the version in-line (as in the .NET Standard csproj format), maybe you don't have time to do it for all your projects.
Solution:
Using a C# script, you could get all the items in your csproj files containing PackageReference as their tag-name.
Then you could do one of two things:
- Continue text scrapping until you find (for each item) a regex like this:
(Version="*")
, which will allow you to find the version for each PackageReference - Serialize the items to your favorite format (JSON works) to get the data divided in a dictionary, where you can just get the name and version from, together with any other data you might need.
I hope this helps.
add a comment |
PackageReference as a package management format only works on a per project basis.
So you would need to "analyze" each project individually.
From the commandline, there "will" be a way to list all the packages.
It's the "dotnet list package" command.
I say will, because it's still in preview.
You can download the 2.2.100 version from here.
Related spec.
The simplest usage example is:
dotnet list package YourSln.sln
If you do not want to use a dotnet.exe preview, you can consider writing your own tool, by reading the assets files for each project, which is what the actual command does.
For reference, see code here and here
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%2f53435715%2fget-a-list-of-all-nuget-packages-used-in-a-solution%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
I'm sure there are better ways to do this, but here's a round-the-houses PowerShell way when using PackageReferences:
Get-Content .<solution>.sln | where { $_ -match "Project.+, ""(.+)""," } | foreach { $matches[1] } | % {Get-Content $_ | Find "<PackageReference Include" } | Sort-Object -Unique
Run it in the folder where the .sln lives.
It produces output like this:
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.5.0" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.4" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.5" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
I intentionally remove duplicates; you could omit that part if you prefer.
In my case, this matches the output from Get-Package
with the one exception being Microsoft.NETCore.App
, as that is not listed as a dependency anywhere, but is probably rather derived from <TargetFramework>netcoreapp2.1</TargetFramework>
.
Nice idea. but for some reason it does not show the version number. i.e<PackageReference Include="Newtonsoft.Json">
Is there something that i missing? @sellotape
– Avihay
Nov 25 '18 at 8:38
@Avihay - it's just showing the line in the .csproj there. Have a look inside your .csproj's and see whether there is something fundamentally different to those in my example.
– sellotape
Nov 25 '18 at 8:45
add a comment |
I'm sure there are better ways to do this, but here's a round-the-houses PowerShell way when using PackageReferences:
Get-Content .<solution>.sln | where { $_ -match "Project.+, ""(.+)""," } | foreach { $matches[1] } | % {Get-Content $_ | Find "<PackageReference Include" } | Sort-Object -Unique
Run it in the folder where the .sln lives.
It produces output like this:
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.5.0" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.4" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.5" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
I intentionally remove duplicates; you could omit that part if you prefer.
In my case, this matches the output from Get-Package
with the one exception being Microsoft.NETCore.App
, as that is not listed as a dependency anywhere, but is probably rather derived from <TargetFramework>netcoreapp2.1</TargetFramework>
.
Nice idea. but for some reason it does not show the version number. i.e<PackageReference Include="Newtonsoft.Json">
Is there something that i missing? @sellotape
– Avihay
Nov 25 '18 at 8:38
@Avihay - it's just showing the line in the .csproj there. Have a look inside your .csproj's and see whether there is something fundamentally different to those in my example.
– sellotape
Nov 25 '18 at 8:45
add a comment |
I'm sure there are better ways to do this, but here's a round-the-houses PowerShell way when using PackageReferences:
Get-Content .<solution>.sln | where { $_ -match "Project.+, ""(.+)""," } | foreach { $matches[1] } | % {Get-Content $_ | Find "<PackageReference Include" } | Sort-Object -Unique
Run it in the folder where the .sln lives.
It produces output like this:
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.5.0" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.4" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.5" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
I intentionally remove duplicates; you could omit that part if you prefer.
In my case, this matches the output from Get-Package
with the one exception being Microsoft.NETCore.App
, as that is not listed as a dependency anywhere, but is probably rather derived from <TargetFramework>netcoreapp2.1</TargetFramework>
.
I'm sure there are better ways to do this, but here's a round-the-houses PowerShell way when using PackageReferences:
Get-Content .<solution>.sln | where { $_ -match "Project.+, ""(.+)""," } | foreach { $matches[1] } | % {Get-Content $_ | Find "<PackageReference Include" } | Sort-Object -Unique
Run it in the folder where the .sln lives.
It produces output like this:
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.5.0" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.4" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.5" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
I intentionally remove duplicates; you could omit that part if you prefer.
In my case, this matches the output from Get-Package
with the one exception being Microsoft.NETCore.App
, as that is not listed as a dependency anywhere, but is probably rather derived from <TargetFramework>netcoreapp2.1</TargetFramework>
.
answered Nov 22 '18 at 19:36
sellotapesellotape
5,65821619
5,65821619
Nice idea. but for some reason it does not show the version number. i.e<PackageReference Include="Newtonsoft.Json">
Is there something that i missing? @sellotape
– Avihay
Nov 25 '18 at 8:38
@Avihay - it's just showing the line in the .csproj there. Have a look inside your .csproj's and see whether there is something fundamentally different to those in my example.
– sellotape
Nov 25 '18 at 8:45
add a comment |
Nice idea. but for some reason it does not show the version number. i.e<PackageReference Include="Newtonsoft.Json">
Is there something that i missing? @sellotape
– Avihay
Nov 25 '18 at 8:38
@Avihay - it's just showing the line in the .csproj there. Have a look inside your .csproj's and see whether there is something fundamentally different to those in my example.
– sellotape
Nov 25 '18 at 8:45
Nice idea. but for some reason it does not show the version number. i.e
<PackageReference Include="Newtonsoft.Json">
Is there something that i missing? @sellotape– Avihay
Nov 25 '18 at 8:38
Nice idea. but for some reason it does not show the version number. i.e
<PackageReference Include="Newtonsoft.Json">
Is there something that i missing? @sellotape– Avihay
Nov 25 '18 at 8:38
@Avihay - it's just showing the line in the .csproj there. Have a look inside your .csproj's and see whether there is something fundamentally different to those in my example.
– sellotape
Nov 25 '18 at 8:45
@Avihay - it's just showing the line in the .csproj there. Have a look inside your .csproj's and see whether there is something fundamentally different to those in my example.
– sellotape
Nov 25 '18 at 8:45
add a comment |
Writing a script that finds the occurrences of the tag PackageReference on each one of the csproj files is a great idea, as proposed by selotape.
This solution won't work if your csproj file has something like this:
<PackageReference Include"SomePackage">
<Version>1.0.42</Version>
</PackageReference>
Even though I recommend that you change the format to state the version in-line (as in the .NET Standard csproj format), maybe you don't have time to do it for all your projects.
Solution:
Using a C# script, you could get all the items in your csproj files containing PackageReference as their tag-name.
Then you could do one of two things:
- Continue text scrapping until you find (for each item) a regex like this:
(Version="*")
, which will allow you to find the version for each PackageReference - Serialize the items to your favorite format (JSON works) to get the data divided in a dictionary, where you can just get the name and version from, together with any other data you might need.
I hope this helps.
add a comment |
Writing a script that finds the occurrences of the tag PackageReference on each one of the csproj files is a great idea, as proposed by selotape.
This solution won't work if your csproj file has something like this:
<PackageReference Include"SomePackage">
<Version>1.0.42</Version>
</PackageReference>
Even though I recommend that you change the format to state the version in-line (as in the .NET Standard csproj format), maybe you don't have time to do it for all your projects.
Solution:
Using a C# script, you could get all the items in your csproj files containing PackageReference as their tag-name.
Then you could do one of two things:
- Continue text scrapping until you find (for each item) a regex like this:
(Version="*")
, which will allow you to find the version for each PackageReference - Serialize the items to your favorite format (JSON works) to get the data divided in a dictionary, where you can just get the name and version from, together with any other data you might need.
I hope this helps.
add a comment |
Writing a script that finds the occurrences of the tag PackageReference on each one of the csproj files is a great idea, as proposed by selotape.
This solution won't work if your csproj file has something like this:
<PackageReference Include"SomePackage">
<Version>1.0.42</Version>
</PackageReference>
Even though I recommend that you change the format to state the version in-line (as in the .NET Standard csproj format), maybe you don't have time to do it for all your projects.
Solution:
Using a C# script, you could get all the items in your csproj files containing PackageReference as their tag-name.
Then you could do one of two things:
- Continue text scrapping until you find (for each item) a regex like this:
(Version="*")
, which will allow you to find the version for each PackageReference - Serialize the items to your favorite format (JSON works) to get the data divided in a dictionary, where you can just get the name and version from, together with any other data you might need.
I hope this helps.
Writing a script that finds the occurrences of the tag PackageReference on each one of the csproj files is a great idea, as proposed by selotape.
This solution won't work if your csproj file has something like this:
<PackageReference Include"SomePackage">
<Version>1.0.42</Version>
</PackageReference>
Even though I recommend that you change the format to state the version in-line (as in the .NET Standard csproj format), maybe you don't have time to do it for all your projects.
Solution:
Using a C# script, you could get all the items in your csproj files containing PackageReference as their tag-name.
Then you could do one of two things:
- Continue text scrapping until you find (for each item) a regex like this:
(Version="*")
, which will allow you to find the version for each PackageReference - Serialize the items to your favorite format (JSON works) to get the data divided in a dictionary, where you can just get the name and version from, together with any other data you might need.
I hope this helps.
answered Nov 28 '18 at 11:38
iosi Giosi G
532316
532316
add a comment |
add a comment |
PackageReference as a package management format only works on a per project basis.
So you would need to "analyze" each project individually.
From the commandline, there "will" be a way to list all the packages.
It's the "dotnet list package" command.
I say will, because it's still in preview.
You can download the 2.2.100 version from here.
Related spec.
The simplest usage example is:
dotnet list package YourSln.sln
If you do not want to use a dotnet.exe preview, you can consider writing your own tool, by reading the assets files for each project, which is what the actual command does.
For reference, see code here and here
add a comment |
PackageReference as a package management format only works on a per project basis.
So you would need to "analyze" each project individually.
From the commandline, there "will" be a way to list all the packages.
It's the "dotnet list package" command.
I say will, because it's still in preview.
You can download the 2.2.100 version from here.
Related spec.
The simplest usage example is:
dotnet list package YourSln.sln
If you do not want to use a dotnet.exe preview, you can consider writing your own tool, by reading the assets files for each project, which is what the actual command does.
For reference, see code here and here
add a comment |
PackageReference as a package management format only works on a per project basis.
So you would need to "analyze" each project individually.
From the commandline, there "will" be a way to list all the packages.
It's the "dotnet list package" command.
I say will, because it's still in preview.
You can download the 2.2.100 version from here.
Related spec.
The simplest usage example is:
dotnet list package YourSln.sln
If you do not want to use a dotnet.exe preview, you can consider writing your own tool, by reading the assets files for each project, which is what the actual command does.
For reference, see code here and here
PackageReference as a package management format only works on a per project basis.
So you would need to "analyze" each project individually.
From the commandline, there "will" be a way to list all the packages.
It's the "dotnet list package" command.
I say will, because it's still in preview.
You can download the 2.2.100 version from here.
Related spec.
The simplest usage example is:
dotnet list package YourSln.sln
If you do not want to use a dotnet.exe preview, you can consider writing your own tool, by reading the assets files for each project, which is what the actual command does.
For reference, see code here and here
answered Nov 24 '18 at 22:20
impsimps
539715
539715
add a comment |
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%2f53435715%2fget-a-list-of-all-nuget-packages-used-in-a-solution%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
1
Can't you just read them from the project files?
– stuartd
Nov 22 '18 at 17:32
they are explicitly listed in plain text packages.config for each project. There are usually hints as to the location of the package in the project files, but Nuget Package restore uses the packages.config.
– user5292841
Nov 22 '18 at 18:01
@JeffDavies Thank for your answer. I have a solution with more than 150 projects. so search it may not be the best solution for me, but that will do the work. thanks!
– Avihay
Nov 25 '18 at 8:10
@Avihay, this powershell command will list all packages.configs: Get-ChildItem -Path $path -Recurse -Filter "packages.config" | select fullname . I'm not sufficiently versed in powershell to cat the contents of files from this list. Could easily do it in Bash.
– user5292841
Nov 25 '18 at 14:22