Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose dotnet list package/reference functionality to traversal projects #131

Closed
MeikTranel opened this issue Sep 27, 2019 · 1 comment · Fixed by #141
Closed

Expose dotnet list package/reference functionality to traversal projects #131

MeikTranel opened this issue Sep 27, 2019 · 1 comment · Fixed by #141
Labels
Bug Something isn't working

Comments

@MeikTranel
Copy link
Contributor

MeikTranel commented Sep 27, 2019

When using Traversal Projects with an all PackageReference (even setting PackageRestoreStyle via Directory.Build.props) workspace, dotnet list Traversal.proj package fails with message:

The project `D:\test\Traversal.proj` uses package.config for NuGet packages, while the command works only with package reference projects.

When trying to do dotnet list Traversal.proj reference we get:

There are no Project to Project references in project Traversal.proj.

In my opinion a traversal project should be able to produce a project and package dependency graph (or at least a table containing all packages).
I know this issue might be better fit for the dotnet cli, but i wanted feedback here first. Maybe im doing something wrong even.
Here's a minimal repro although i don't think this cli feature works at all with traversal

@jeffkl
Copy link
Contributor

jeffkl commented Sep 27, 2019

This should be easy to fix. NuGet determines if the project supports PackageReference with this criteria:

https://github.com/NuGet/NuGet.Client/blob/9173d9bc53b5123d5cadec6cae513149d40505b0/src/NuGet.Core/NuGet.CommandLine.XPlat/Utility/MSBuildAPIUtility.cs#L312

The Traversal SDK needs to set RestoreProjectStyle:

<PropertyGroup>
  <RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>

Which is what the .NET Core SDK does: https://github.com/dotnet/sdk/blob/0979dd3c53a8971a5434cf4bc68efd103fe5ea68/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.props#L88

It works as long as you have added any package references already:

D:\MSBuildSdks>dotnet list dirs.proj package
Project 'dirs' has the following package references
   [net40]:
   Top-level Package             Requested   Resolved
   > Nerdbank.GitVersioning      2.3.151     2.3.151
   > StyleCop.Analyzers          1.0.2       1.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants