2

I need to generate a dependency tree (or at least a dependency list) of .NET Framework 4.6.1. project. I need to deliver such a list to the legal department of my company. It's a Windows application with package.config file. I am looking for a command which I can run in terminal to generate dependency tree or list, excluding .NET 4.6.1 runtime packages.

I was trying dotnet list package, but it works only with .NET Core.

I was also trying to run combinations of NuGet commands: Get-Content, Get-Package, Select. The output I receive is different from what I see in Visual Studio:

console output

enter image description here

I would like to see the similar output in my console to Visual Studio window. How do you think I can solve my issue?

1 Answer 1

3

you can make dotnet list package and all the .NET CLI running fine with .NET Framework by converting your project to the new project format.

It will be much easier when you already converted to PackageReference and you can easily do it by notepad style editing your .csproj file.

I found this helpful in the past: https://natemcmaster.com/blog/2017/03/09/vs2015-to-vs2017-upgrade/

Sign up to request clarification or add additional context in comments.

10 Comments

once converted your .csproj to new project format (targeting .NET Framework) it runs fine and you can check your Nuget dependencies in a nice tree view in VS as well.
Thank you, it indeed helped. Do you know if I can exclude from dotnet list package transitive dependencies that come from .NET Framework itself? I mean generally System. and Microsoft. namespaces, but I don't want to exclude these namespaces once they have to be installed explicitely as project dependency.
@michail_w did you try dotnet list package --include-transitive | WHERE { $_ -notmatch ' System.| Microsoft.'} in Powershell?
Yes, I tried. It works fine. However, it can be false positive. Anyone can create a System. or Microsoft. package which will become my transitive dependency, but it won't be part of the .NET Framework itself. I don't want to miss that out. I agree it's an edge case, but I won't be surprised if it ever happens.
Many thanks for "dotnet list package --include-transitive" !!! Really usedful command!
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.