dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.6k stars 1.03k forks source link

dotnet build --no-dependencies -r platform tries to build its dependencies anyway #8718

Open jhudsoncedaron opened 6 years ago

jhudsoncedaron commented 6 years ago

Have a project with a bunch of dependent projects

build the whole thing with dotnet build

try to build the final exe for a specific platform with dotnet build --no-dependencies -r win7-x64

discover everything got built again! There's no cause for that!

This appears to be the reason https://github.com/dotnet/cli/issues/7641 won't bisect.

Specific case: the bad behavior is happening when the target's dependencies have only ever been built without -r platform (that is, they end up compiled for the any rid). Whatever the behavior should be, the current behavior isn't it. Perhaps it should say "Hey, you haven't built xxx for rid yyy yet."

jhudsoncedaron commented 6 years ago

Update: it's not actually building the dependencies but it is evaluating the dependencies recursively in a way that causes spurious build failures.

livarcocc commented 6 years ago

It needs to evaluate the dependencies that we can discover what we need to copy to the final output of the project. I don't see how to get around that.

jhudsoncedaron commented 6 years ago

Easy. Open <outputdllname>.deps.json.

The spurious build errors come from trying to evaluate the dependent project with -r platform loaded.