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

dotnet restore does not restore P2P references with ReferenceOutputAssembly=false #4700

Closed
mellinoe opened this issue Feb 27, 2017 · 6 comments
Assignees
Milestone

Comments

@mellinoe
Copy link

NOTE: I originally filed this issue here: https:/dotnet/cli/issues/5760.

Steps to reproduce

  1. Create two class library projects, A.csproj and B.csproj
  2. Add this to A.csproj:
  <ItemGroup>
    <ProjectReference Include="..\B\B.csproj">
      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
    </ProjectReference>
  </ItemGroup>
  1. Run dotnet restore A.csproj, dotnet msbuild A.csproj

Expected behavior

Both A and B are restored, and both build successfully (because of the P2P reference).

Actual behavior

Only A is restored. When msbuild is called on A.csproj, it attempts to build B.csproj first, because of the ProjectReference. This fails because B.csproj has not been restored yet. If B is manually restored, then A can be built. If ReferenceOutputAssembly is set to true (default value), then B.csproj is automatically restored when A.csproj is restored.

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-rc4-004777)

Product Information:
 Version:            1.0.0-rc4-004777
 Commit SHA-1 hash:  18c01886cd

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   E:\dotnets\2-8-17\sdk\1.0.0-rc4-004777
@rohit21agrawal
Copy link
Contributor

@emgarten i believe this was done intentionally?

@emgarten
Copy link
Member

emgarten commented Feb 27, 2017

It looks like restore should include this in the recursive restore even though it isn't an actual dependency.

The workaround for this is to create a solution containing all projects and restore that.

@mellinoe
Copy link
Author

even though it isn't an actual dependency

What do you mean by that? It's certainly an actual dependency; the referencing project just doesn't use it as a compiler reference.

@emgarten
Copy link
Member

emgarten commented Apr 30, 2017

I am not able to repro this anymore, it looks like it was fixed with NuGet/NuGet.Client@f140092

@mellinoe
Copy link
Author

mellinoe commented May 1, 2017

@emgarten Glad to hear it is fixed, but that link is dead.

@emgarten
Copy link
Member

emgarten commented May 1, 2017

@mellinoe updated, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants