dotnet / NuGet.BuildTasks

The build tasks used to pick up package content from project.lock.json.
MIT License
45 stars 61 forks source link

Don't show project references as package references in Solution Explorer #33

Closed tmeschter closed 7 years ago

tmeschter commented 7 years ago

When a NuGet restore generates a project.assets.json file it includes information not only on which NuGet packages are used by a project, but which other projects are referenced as well. When reading the list of dependencies from project.assets.json we currently make no distinction between a package dependency versus a project dependency. The result is that projects get included with the list of packages we show in the Solution Explorer under the References node--and since the language service already shows project references there, we end up with two nodes representing the same thing.

The fix here is to filter out the project dependency in the build task. For every dependency, we check it against the items in the "library" section of the project.assets.json file. This specifies whether a particular "library" comes from a project or a package. If it does not explicitly state that it is a project, we assume it is a package.

A unit test has been added to cover this scenario.

tmeschter commented 7 years ago

@jasonmalinowski @rrelyea @emgarten Please review.

jasonmalinowski commented 7 years ago

@tmeschter Don't forget to merge this since it looks like it already went into the other codebase. Did we just split universe right now since this is colliding with something else?

tmeschter commented 7 years ago

@jasonmalinowski There were a bunch of changes made in parallel since we weren't sure which ones would be taken for 15.1 and which wouldn't. Now that we know I need to figure out where to check in all the changes--I may make a 15.1 branch.

In this case the conflict is fairly trivial to resolve.